Rabu, 25 Februari 2015

Using �UpStart� to manage jobs on Ubuntu

Smoga sobat semua tidak bosan bertemu saya he he, bagaimana kabarnya nih sobat semua ? yang pastinya sehat dan bahagia ya. Ok langsung saja pada topik kita kali ini adalah Using �UpStart� to manage jobs on Ubuntu."
In the past, I�ve always used SysVinit to manage the loading and running of persistent processes/services on *nix servers. Whilst refreshing my memory in order to get a process loaded at boot time, I came acrossUpStart, which is intended as a replacement for the SysVinit system. So I thought I�d give it a go.
I�m using a headless Ubuntu server 12.04 LTS and I have a python script that I want to keep running. It was pretty straight forward. All I had to do was create a file in�/etc/init�calledmyjobname.conf and the service then has the name�myjobname. The file in /etc/init looks like this:
description     "My Python Script etc.."
author "My Name Here <me@myplace.com>"

start on runlevel [2345]
stop on runlevel [!2345]

respawn

exec /usr/local/bin/my_script.py
Which essentially says, start on run levels 2, 3, 4 and 5 and stop on any run-level that is�not�2, 3, 4 or 5. If the process dies, restart it (respawn) and the command to run follows the exec.
Clearly the contents of the file can be a lot more detailed and have many options, including pre and post start scripts etc. More detail of which can be found�here.
You then have to reload the upstart configuration to get it to recognise the file and start it running (initially I had a problem with my script which I saw through�dmesg). To reload the configuration, run�sudo initctl reload-configuration.
To list jobs and their statuses, use�initctl list�and to start/stop jobs, usesudo initctl start myjobname�and�sudo initctl stop myjobname�respectively.
Finally, if I want to see any output from my script, there is also a log file under /var/log/upstart, so I can just use:
sudo tail -f /var/log/upstart/myjobname.log


"
Source : http://blog.darrenparkinson.uk/2013/01/using-upstart-to-manage-jobs-on-ubuntu.html

         Sekian bahasan tentang Using �UpStart� to manage jobs on Ubuntu ini dan penutup dari saya semoga berkenan di hati dan kami ucapkan terima kasih yang sebesar-besarnya.



Video yang berkaitan dengan Using �UpStart� to manage jobs on Ubuntu


0 comments:

Posting Komentar