You are not logged in.

#1 2008-12-03 22:31:26

sveinhal
Member
Registered: 2008-10-24
Posts: 3

Running program at startup [as ordinary user]

Hi,

I want to be able to run a command at system startup as an ordinary, non-priveledged user. In FreeBSD (where I came from before coming to Arch), there is a @reboot directive in crontab, allowing me to set up command in my crontab file to be run at startup, just as any other cronjob (only at startup instead of at a specific time).

The cron that comes with Arch doesn't seem to support the @reboot directive. Is there another simple mechanisms available for ordnary users?


Svein Halvor

Last edited by sveinhal (2008-12-03 22:31:52)

Offline

#2 2008-12-03 22:36:37

FreakGuard
Member
Registered: 2008-04-27
Posts: 103

Re: Running program at startup [as ordinary user]

something like your .xinitrc? or session start from your desktop? or maybe `/bin/su freak -l -c <some programm>` in a daemon-script?

Offline

#3 2008-12-03 22:40:32

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: Running program at startup [as ordinary user]

i use fcron as a replacement for cron; it allows running jobs as users and/or @boot, it's in the repos.

$ sudo pacman -S fcron

-- read manpage for @boot option --

$ sudo fcrontab -u USERNAME -e

Last edited by brisbin33 (2008-12-03 22:42:07)

Offline

#4 2008-12-03 22:45:19

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Running program at startup [as ordinary user]

There's a few things you could do. I run all my startup apps in my xinitrc and the like, so I don't need functionality like this.

Possibility 1: Create a "framework" for this. In /etc/rc.local, add something like:

cd /home
for user in *; do
   if [ -x "/home/$user/.rc.local" ]; then
      su $user -c "/home/$user/.rc.local"
   fi
done

Alternatively do the same thing for rc.shutdown.local

Possibility 2: Use a different cron. I think we have 3 floating around somewhere. If not feel free to package one that works to your liking and stick it in the AUR

Possibility 3: Create an /etc/rc.d/ script that drops privileges to your user and runs all the apps you need

... there's lots more I'm sure ...

Offline

Board footer

Powered by FluxBB