Upstart is a great solution for this. An example HOWTO for Ubuntu Server 14.04:
1. Stop all currently running
gns3server processes. Run the following from the terminal:
Code:
sudo pkill gns3server
2. Identify the current user. This will be needed for the
setuid value in the Upstart job config file. For example, I'm currently logged in as
gns3 as this is the account that contains my personal GNS3 directory (projects, images, etc.). Run the following from the terminal:
Code:
id -un
3. Get the location of the
gns3server binary. For example,
gns3server is located at
/usr/local/bin/gns3server on my system. This will be needed for the
exec value in the Upstart job config file. Run the following from the terminal:
Code:
type gns3server
4. Create the Upstart job config file with a text editor. Run the following from the terminal:
Code:
sudo nano /etc/init/upstart-gns3server.conf
...and enter/save the following:
Code:
description "GNS3 Server"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
setuid gns3
exec /usr/local/bin/gns3server
5. Validate the syntax is correct for the Upstart job config file. Run the following from the terminal:
Code:
init-checkconf /etc/init/upstart-gns3server.conf
6. Reboot to verify. Run the following from the terminal:
Code:
sudo reboot
7. Verify the
gns3server process(es) are started upon login. Run the following from the terminal:
Code:
initctl status upstart-gns3server
pgrep -a gns3server
Note: Log will be located in
/var/log/upstart directory. For example, if you wanted to check on any
Warning or
Errors, run the following from the terminal:
Code:
sudo egrep '\[W|\[E' /var/log/upstart/upstart-gns3server.log
Need to
stop/
start/
restart manually? Run one of the following from the terminal:
Code:
sudo initctl stop upstart-gns3server
sudo initctl start upstart-gns3server
sudo initctl restart upstart-gns3server