Is there a way to do this so when I reboot my linux server the process will reopen on startup?

link|improve this question
feedback

migrated from stackoverflow.com Oct 2 '11 at 10:39

This question came from our site for professional and enthusiast programmers.

1 Answer

up vote 8 down vote accepted

Usually, you need to add a startup script in /etc/rc.d/ or /etc/rc.local. Thats how all daemons are started. However you need to have root permissions for this.

Since you tagged it as ssh, I guess you don't have root permissions. So you can create a crontab entry that runs a script to launch your process after every reboot:

$ crontab -e

Add the following line in the file that opens up:

@reboot  /path/to/your_script.sh 
link|improve this answer
Good Idea. I will try that. After adding the cron, how would I remove it if needed to. – David Meyer Oct 2 '11 at 6:28
Same as before. crontab -e and delete that line from the file – skjaidev Oct 2 '11 at 6:29
When trying the command crontab -e it respods "no crontab for (myusername)" How do I make one? – David Meyer Oct 2 '11 at 6:50
Strange, it should create one (after complaining) if there isn't any. What version of linux are you on? – skjaidev Oct 2 '11 at 6:56
Basic 64-bit Amazon Linux AMI 2011.09 – David Meyer Oct 2 '11 at 6:57
show 3 more comments
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.