forums › forums › Monyog › Monyog Deployment › Ubuntu Init Script?
- This topic is empty.
-
AuthorPosts
-
-
April 6, 2011 at 6:34 pm #12299aemadridMember
Has anybody come up with a good init script for Debian/Ubuntu and would like to share?
-
April 6, 2011 at 8:08 pm #32119peterlaursenParticipant
Do you request an init script tio start MONyog in Ubuntu – so that MONyog will start with the OS?
-
April 6, 2011 at 8:26 pm #32120aemadridMember
Yes, exactly. RH systems get it with the RPM but the tar file doesn't have anything like it.
'peterlaursen' wrote:Do you request an init script tio start MONyog in Ubuntu – so that MONyog will start with the OS?
-
April 7, 2011 at 6:49 am #32121Rituparna KashyapMember
You can install scripts like below in the init.d
Step 1 : Created a script called MONyogd in the /etc/init.d/
Step 2 : Copy the following into the script. ( Change the MONyog installation directory if it is not /usr/local/ , it is defined in INSTALLDIR variable in the script)
#!/bin/bash
INSTALLDIR=”/usr/local”
MONYOGBIN=”$INSTALLDIR/MONyog/bin/MONyog”
case “$1” in
'start')
echo “Starting MONyog: “
if [ $((`pgrep MONyog-bin | wc -l`)) -gt 0 ]; then
echo “MONyog is already running.”
else
# Start MONyog.
$MONYOGBIN start
if [ $((`pgrep MONyog-bin | wc -l`)) -gt 0 ]; then
echo “MONyog started successfully!”
else
echo “Unable to start MONyog.”
exit 0
fi
fi
;;
'stop')
if [ $((`pgrep MONyog-bin | wc -l`)) -gt 0 ]; then
echo -n “Sending MONyog signal to stop: “
pkill -15 -x MONyog-bin
echo -n “Shutting down: “
echo ” “
echo “MONyog stopped successfully!”
else
echo “MONyog is not in memory…”
fi
;;
'reload'|'restart')
echo “Restarting MONyog…”
$0 stop
$0 start
;;
'status')
if [ $((`pgrep MONyog-bin`)) -gt 0 ]; then
echo -n “MONyog is running!”
echo ” “
else
echo -n “MONyog is NOT running!”
echo ” “
fi
;;
*)
echo “Usage: $0 {start|stop|restart|reload|status}”
exit 1
;;
esac
Step 3 : make the script executable by chmod +x /etc/init.d/MONyogd
Step 4 : Use Debian utility update-rc.d to install the script.
update-rc.d MONyogd defaults
This will make MONyog start up in boot time. You can also issue service MONyogd start/stop/restart/status any time to have the respective action done.
-
April 7, 2011 at 3:49 pm #32122aemadridMember
Thanks so much! I hacked one out of nginx but this is so much cleaner.
-
-
AuthorPosts
- You must be logged in to reply to this topic.