I am not good with bash, so I use /etc/rc.local
to start the services every time my ubuntu server 12.04 LTS restarted.
#!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. ifconfig eth0 promisc /usr/local/bin/suricata -c /etc/suricata/suricata.yaml -i eth0 -D /usr/local/bin/barnyard2 -c /etc/suricata/barnyard2.conf -d /var/log/suricata -f unified2.alert -w /var/log/suricata/suricata.waldo -D cd /var/www/snorby && /usr/bin/ruby script/delayed_job start cd /var/www/snorby && /usr/local/bin/rails runner 'Snorby::Jobs::SensorCacheJob.new(false).perform; Snorby::Jobs::DailyCacheJob.new(false).perform' exit 0