0

If I open a terminal and run this in the terminal: source /home/deploy/script.sh

It will execute script.sh

command below is what i wrote in script.sh

cd /var/www/applikasi-siao/iClockServer && thin -e production -p 2345 -P tmp/pids/thin.pid -l logs/thin/log start

this command above must run in the same terminal and the terminal should stay open.

I created script.sh so when i open terminal and type source /home/deploy/script.sh it will run

cd /var/www/applikasi-siao/iClockServer && thin -e production -p 2345 -P tmp/pids/thin.pid -l logs/thin/log start

I need all of this processes run automatically every reboot without manually opening a terminal and typing source /home/deploy/script.sh

d a i s y
  • 5,551

1 Answers1

0

Cron/Cronjobs will allow you to automate the task above to after every restart HOWEVER, it won't leave a terminal window open.

For info on Cron you can look at the CronHowto: https://help.ubuntu.com/community/CronHowto

Also please mention what operating system you are using.

Crons are really quite interesting so I highly recommend reading into them but TLDR.

Open a terminal window.

Install Cron

sudo apt-get install gnome-schedule

After that has completed type

crontab -e

If the script requires administrative privileges use:

sudo crontab -e

And then at the bottom of the file add the following with the path being to where that script is.

@reboot /home/username/start_application.sh
Robby1212
  • 910
  • 1
  • 10
  • 28