Sign in with
Sign up | Sign in
Your question

Automatically running shell scripts using Upstart

Tags:
  • Ubuntu
  • Upstart
  • Shell
  • Servers
  • Linux
Last response: in Linux/Free BSD
Share
February 4, 2014 4:10:21 AM

Hey,

I got some shell scripts that I would like to run on start-up on my Linux server. I have been reading up on the Upstart feature, which seems to be the (best) way to do this. Is that correct?

And if so, is it correct that i need a .conf file for each located in the /etc/init/ folder, right?

And lately, am I correct in assuming that such a script could look like this:
  1. # Dataserver Service Template
  2.  
  3. description "Server"
  4. author "Me <my@email.com>"
  5.  
  6. start on runlevel [2345] # Start on the given runlevels
  7. stop on runlevel [!2345] # Stop if NOT in one of the given runlevels
  8.  
  9. respawn # Restart the job if ended without -o
  10. respawn limit 5 10 # Maximum of 5 respawn in a 10 second period
  11.  
  12. env SERVER_NAME = somename # Change to specifed server
  13.  
  14. # Run the actual server script
  15. exec C:/SERVER_NAME/server.sh

More about : automatically running shell scripts upstart

a b 5 Linux
February 4, 2014 6:06:03 AM

Actually, I use cron. You can schedule when events happen, daily, hourly every 37 seconds even at boot.

A good explanation is here https://help.ubuntu.com/community/CronHowto

in a nutshell normal programs you type in a terminal on your server
crontab -e
add the command you want run and save

for a job that needs root you make the crontab in root
for example an Ubuntu server
sudo crontab -e
an example command to launch the openmeetings sh script when system boots

@reboot sh /var/www/openmeetings/red5.sh
m
0
l
February 17, 2014 11:19:34 PM

stillblue said:
Actually, I use cron. You can schedule when events happen, daily, hourly every 37 seconds even at boot.

A good explanation is here https://help.ubuntu.com/community/CronHowto

in a nutshell normal programs you type in a terminal on your server
crontab -e
add the command you want run and save

for a job that needs root you make the crontab in root
for example an Ubuntu server
sudo crontab -e
an example command to launch the openmeetings sh script when system boots

@reboot sh /var/www/openmeetings/red5.sh


Thank you for the response (and sorry for my late feedback). I will consider Cron, but I would still like to know if I got the part about how to use Upstart correct. Is there anyone who can help regarding that?
m
0
l
Related resources
!