Is there a way to run a script on startup as a user on Debian 7? My script is
screen -dmS name ./script.sh
So essentially I want to run a script on startup that would make a screen window and run a script in it
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
You can faff about with an elaborate
sudo command in
/etc/rc.local, but the best way is to use the user's
cron has some nifty scheduling keywords including
@reboot which will run the defined script or command when the system is rebooted.
So, as that user, run
crontab -e, and add this line to the file:
@reboot screen -dmS ScreenName /path/to/your/script.sh
If you mean when you start the desktop environment then odds are you are using GNOME and this may help you at least get an idea of what to look for.
Ok so from the comments what you want is something to run every time a terminal session is started.
A good place for this is in the user's ~/.profile, or in the /etc/profile if you want it to happen for all users.