In this post we will learn , how to create upstart event system for ghost blog on Ubuntu . In our previous post, we have written how to install and run the ghost blog on Ubuntu . By using upstart event system, we can start,stop and restart the ghost with service command. Whereas on system reboot the ghost process will also run.
In our previous post, we have installed the ghost on
/opt/ghost directory. Hence, in upstart script replace the /opt/ghost with your ghost directory.
Note: In below given script replace /opt/ghost with absolute path of your ghost directory.
Create upstart event system for ghost blog
Create file called ghost.conf inside /etc/init/ directory
Paste given below content in /etc/init/ghost.conf file. Then save and exit.
# ghost blogging platform # Description: "An Upstart task for ghost server" # Creation Date : 07-May-2015 # author "Sharad Kumar Chhetri" start on startup script cd /opt/ghost npm start --production end script
Manage ghost with service command
To start ghost blog
service ghost start
To stop ghost blog
service ghost stop
To restart ghost blog
service ghost restart
To check statu ghost blog
service ghost status
Note: Because of ghost upstart event system, whenever system is rebooted the ghost will run automatically