You are not logged in.

#1 2011-06-28 08:45:50

Lockheed
Member
Registered: 2010-03-16
Posts: 1,527

Autorestart 'pcmanfm --desktop' upon crash

Every now and then pcmanfm --desktop crashes and since it handles my desktop, I'd like it to restart automatically, followed by conky (which disappears when pcmanfm crashes).

Is there a way to do this?

Offline

#2 2011-06-28 10:57:20

the_isz
Member
Registered: 2009-04-14
Posts: 280

Re: Autorestart 'pcmanfm --desktop' upon crash

http://sourceforge.net/tracker/index.ph … tid=801864

This bug has been reported for quite some time now. Unfortunately, it seems that
pcmanfm doesn't receive any development at the moment hmm

Offline

#3 2011-06-28 11:02:20

Lockheed
Member
Registered: 2010-03-16
Posts: 1,527

Re: Autorestart 'pcmanfm --desktop' upon crash

Ok, but I suppose we could find a way around it.
For example, if emerald crashes, I think this run command will ensure it restarts:

while true; do emerald --replace; sleep 1; done &

PS
I am not sure the bug from this link is the same as mine. Mine crashes randomly, sometimes days apart, when I click on the desktop or sometimes even when I do nothing, but it is perfectly usable otherwise.

Last edited by Lockheed (2011-06-28 11:03:59)

Offline

#4 2011-06-28 12:37:54

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: Autorestart 'pcmanfm --desktop' upon crash

you can create a script which checks the pidof pcmanfm -desktop..and if it doesn't find it then restart it. Keep running that script in a while loop like above.


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#5 2011-06-28 12:47:48

Lockheed
Member
Registered: 2010-03-16
Posts: 1,527

Re: Autorestart 'pcmanfm --desktop' upon crash

So, would it be something like this?

while true; do pcmanfm --desktop; sleep 1; done &

Last edited by Lockheed (2011-06-28 12:48:17)

Offline

#6 2011-06-28 13:40:35

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: Autorestart 'pcmanfm --desktop' upon crash

That would create a lot of instances, I believe. Write a script which simply checks if the pidof pcmanfm exists. If it does, do nothing, else start pcmanfm --desktop.

The only flaw I see in that is that if you have pcmanfm (the actual file manager) running -- then its going to give you false positives. Try to see if pcmanfm --desktop generates a separate pid for itself.

#!/bin/sh

##This below line is where you need to check if pcmanfm --desktop provides a separate pid or if you will have to use the pcmanfm's pid.
PID = "$(pidof pcmanfm)"

if [ -n $PID ]; then
  echo "pcmanfm has not crashed"
else
  echo "pcmanfm has crashed, so restarting"
  pcmanfm --desktop
fi

Save this script in a file. Make it executable and then run this script in the while loop that you have in your post above.
I haven't run this code and also my bash skill isn't good, so it may work -- it may not


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#7 2011-06-28 14:35:22

Lockheed
Member
Registered: 2010-03-16
Posts: 1,527

Re: Autorestart 'pcmanfm --desktop' upon crash

As far as I can see form Task Manager, PID for pcmanfm (and --desktop) is assigned randomly, different at every run.

Offline

#8 2011-06-28 14:45:38

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: Autorestart 'pcmanfm --desktop' upon crash

Lockheed wrote:

As far as I can see form Task Manager, PID for pcmanfm (and --desktop) is assigned randomly, different at every run.

That's fine. The if clause in the script is only checking if the pid exists and is not comparing it to any value.


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#9 2011-06-28 14:47:34

Lockheed
Member
Registered: 2010-03-16
Posts: 1,527

Re: Autorestart 'pcmanfm --desktop' upon crash

Ok, you outrun my ability to understand linux lingo. I guess I will just have to manually restart it when it crashes or switch to another file manager. Any suggestions?

Offline

#10 2011-06-28 14:49:02

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: Autorestart 'pcmanfm --desktop' upon crash

Lockheed wrote:

Ok, you outrun my ability to understand linux lingo. I guess I will just have to manually restart it when it crashes or switch to another file manager. Any suggestions?

Have you even tried the script that I gave you ?


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#11 2011-06-28 14:52:28

Lockheed
Member
Registered: 2010-03-16
Posts: 1,527

Re: Autorestart 'pcmanfm --desktop' upon crash

Lol, I totally missed that script. Let me see...

Offline

#12 2011-06-28 19:18:24

Lockheed
Member
Registered: 2010-03-16
Posts: 1,527

Re: Autorestart 'pcmanfm --desktop' upon crash

Apparently, it falls into some failed loop:

bash: line 4: /home/juha/bin/pcman: Permission denied
bash: line 4: /home/juha/bin/pcman: Permission denied
bash: line 4: /home/juha/bin/pcman: Permission denied
bash: line 4: /home/juha/bin/pcman: Permission denied
bash: line 4: /home/juha/bin/pcman: Permission denied
bash: line 4: /home/juha/bin/pcman: Permission denied

Offline

Board footer

Powered by FluxBB