unclejed613
Posts: 55
Joined: Sun Jan 15, 2012 10:49 pm

running a script after a power failure....

Mon Sep 29, 2014 2:07 am

i've been trying to figure out debian's use of scripts during boot... i have a script i want run as user "pi" (uid 1000)... let's just call the script "foo"...
i have the following line entered in /etc/rc.local (this seems to work in other linux distro's but not in debian):

Code: Select all

su- 1000 -c /home/pi/./foo
on the pi it doesn't seem to work.... what am i missing?

User avatar
jojopi
Posts: 3078
Joined: Tue Oct 11, 2011 8:38 pm

Re: running a script after a power failure....

Mon Sep 29, 2014 3:38 am

unclejed613 wrote:su- 1000 -c /home/pi/./foo
Huh? "su-" is not a command. su does not accept numeric uids—you must specify "pi" rather than "1000". The "/./" in the command path is redundant.

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: running a script after a power failure....

Mon Sep 29, 2014 6:39 am

jojopi wrote:
unclejed613 wrote:su- 1000 -c /home/pi/./foo
Huh? "su-" is not a command. su does not accept numeric uids—you must specify "pi" rather than "1000". The "/./" in the command path is redundant.
But maybe the (non-standard) "su-" command does…
Maybe "su-" is something the poster wrote himself.

Also, not *all* of the "/./" is superfluous. You need at least one slash, or else it would be "pifoo".
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

Richdotward
Posts: 17
Joined: Fri Mar 08, 2013 6:35 pm

Re: running a script after a power failure....

Mon Sep 29, 2014 9:24 pm

I use crontab to run a script at boot.

Sudo crobtab -e

Just add

@reboot /home/.......... /....sh

Rich

Return to “Advanced users”