Apache startup enable disable
sudo update-rc.d apache2 disable sudo update-rc.d apache2 enable

seen from Maldives
seen from United States
seen from Yemen
seen from China
seen from China
seen from Netherlands
seen from United States
seen from Germany

seen from Australia
seen from Maldives
seen from United Arab Emirates
seen from United States

seen from United States

seen from United States

seen from China
seen from China
seen from United States
seen from United States

seen from United Kingdom

seen from Brazil
Apache startup enable disable
sudo update-rc.d apache2 disable sudo update-rc.d apache2 enable

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch • No registration required • HD streaming
creating your own init.d script
in a previous post i was talking about using an application called supervisor to manage gunicorn processes. in that post i mentioned describing how to create an init.d script for supervisor. the logic in this init.d script can be applied generally, but it uses supervisor as an example
init.d scripts are scripts which allow a root user to manually start and stop a process. on many linux distributions the scripts live inside /etc/init.d/ or /etc/rc.d/init.d/
it might be necessary to have some knowledge of linux run levels to create an init.d script, and so i might do a future post about it, but for now i'll stick to the init.d script itself.
the script has to follow a certain template; there needs to comments at the very top that specify the name of the service, a description, the run levels and kill order/start order for the service, and other information like where to place the pid file, config file locations, etc. something like this
#!/bin/sh # # supervisord Startup script for supervisord # # chkconfig: 2345 85 15 # processname: supervisord # config: /etc/supervisord.conf # pidfile: /var/run/supervisord.pid # description: Supervisor is a client/server system that # allows its users to monitor and control a # number of processes on UNIX-like operating # systems. # ### BEGIN INIT INFO # Provides: supervisord # Required-Start: $local_fs $remote_fs $network # Required-Stop: $local_fs $remote_fs $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: start and stop supervisord ### END INIT INFO
the rest of it is essentially a bash script, that you can create your own logic with, to determine the conditions for a start or stop or restart, or any other function you would like, such as to check version, reload configs, etc.
you'll want to declare variables at the top
APP="/usr/bin/supervisord" PIDFILE="/var/run/supervisord.pid" LOCKFILE="/var/lock/subsys/supervisord" RETVAL=0
create some functions
start() { if [ -f $PIDFILE ] then failure echo "Supervisor already running... " else nohup nice /usr/bin/supervisord -c /etc/supervisord.conf > /dev/null 2>&1 & RETVAL=$? [ $RETVAL = 0 ] && touch $LOCKFILE PID=`/bin/ps -ef | /bin/grep [s]upervisor | /bin/awk '{ print $2 }'` echo $PID > $PIDFILE success echo "Starting supervisord:" fi } stop() { if [ -f $PIDFILE ] then killproc -p $PIDFILE $APP RETVAL=$? [ $RETVAL = 0 ] && rm -f $LOCKFILE $PIDFILE success echo "Stopping supervisord:" else failure echo "Supervisor is not running... " fi }
then create some function calls and a message to tell the user how to use the script
case "$1" in start) start ;; stop) stop ;; status) status $APP ;; restart) stop start ;; *) echo "Usage: $0 {start|stop|restart|status}" ;; esac
in my example, the logic i used for starting and stopping centers around the existence of a pidfile. on startup, a pidfile is created and placed into a specific location using the pid id of the running supervisor process as its contents. a lockfile is also created to ensure that multiple rogue processes aren't created. on shutdown, the content of the pidfile, (the pid id) is used to find and kill the process. then the pidfile is removed as well as the lockfile.
there are a few functions used, namely 'success', 'failure', 'status' and 'killproc' which come from /etc/init.d/functions. these provide the [OK], [FAILED], 'such and such application is running...' and ability to find and kill a running process functions. you need to include the 'functions' file at the beginning of the init.d script in order to use them.
# Source init functions . /etc/init.d/functions
the script has to go inside /etc/init.d and it must be executable and owned by root. to run it you can do any of
$ sudo /etc/init.d/supervisord start/stop/restart/status $ sudo /sbin/service supervisord start/stop/restart/status as root user $ service supervisord start/stop/restart/status
here's the full script
#!/bin/sh # # supervisord Startup script for supervisord # # chkconfig: 2345 85 15 # processname: supervisord # config: /etc/supervisord.conf # pidfile: /var/run/supervisord.pid # description: Supervisor is a client/server system that # allows its users to monitor and control a # number of processes on UNIX-like operating # systems. # ### BEGIN INIT INFO # Provides: supervisord # Required-Start: $local_fs $remote_fs $network # Required-Stop: $local_fs $remote_fs $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: start and stop supervisord ### END INIT INFO # Source init functions . /etc/init.d/functions APP="/usr/bin/supervisord" PIDFILE="/var/run/supervisord.pid" LOCKFILE="/var/lock/subsys/supervisord" RETVAL=0 start() { if [ -f $PIDFILE ] then failure echo "Supervisor already running... " else nohup nice /usr/bin/supervisord -c /etc/supervisord.conf > /dev/null 2>&1 & RETVAL=$? [ $RETVAL = 0 ] && touch $LOCKFILE PID=`/bin/ps -ef | /bin/grep [s]upervisor | /bin/awk '{ print $2 }'` echo $PID > $PIDFILE success echo "Starting supervisord:" fi } stop() { if [ -f $PIDFILE ] then killproc -p $PIDFILE $APP RETVAL=$? [ $RETVAL = 0 ] && rm -f $LOCKFILE $PIDFILE success echo "Stopping supervisord:" else failure echo "Supervisor is not running... " fi } case "$1" in start) start ;; stop) stop ;; status) status $APP ;; restart) stop start ;; *) echo "Usage: $0 {start|stop|restart|status}" ;; esac
there you go. this isn't the only way to do it, but it's a fairly simple example and should provide you with a good idea of how to make your own.
Add script to startup in raspi
cp yourscriptname to /etc/init.d
sudo update-rc.d yourscriptname defaults
To remove it from startup sudo update-rc.d yourscriptname remove
Source - http://raspberrywebserver.com/serveradmin/run-a-script-on-start-up.html
Fixed: How to start and stop a service? #solution #computers #answer
Fixed: How to start and stop a service? #solution #computers #answer
How to start and stop a service?
Possible Duplicate: What’s the recommended way to enable / disable services?
Are there any other command to start stop restart service in ubuntu other than the below following.
service status-all
service <service name> stop
sudosysv-rc-conf
Answer [by Kris Harper]: How to start and stop a service?
It depends largely on the service. The new and preferred way to…
View On WordPress
Run a program at Raspi bootup through init.d

Anya is live and ready to show you everything. Watch her strip, dance, and perform exclusive shows just for you. Interact in real-time and make your fantasies come true.
Free to watch • No registration required • HD streaming
Fix: Call to daemon in a /etc/init.d script is blocking, not running in background #computers #dev #development
Fix: Call to daemon in a /etc/init.d script is blocking, not running in background #computers #dev #development
Call to daemon in a /etc/init.d script is blocking, not running in background
I have a Perl script that I want to daemonize. Basically this perl script will read a directory every 30 seconds, read the files that it finds and then process the data. To keep it simple here consider the following Perl script (called synpipe_server, there is a symbolic link of this script in /usr/sbin/) :
#!/usr/bin/…
View On WordPress
Answer: How to remove/backup script from /etc/init.d/? #solution #dev #fix
Answer: How to remove/backup script from /etc/init.d/? #solution #dev #fix
How to remove/backup script from /etc/init.d/?
I’ve been working with linux for a while but in a rather simple manner.
I understand that scripts in init.d are executed when the os starts but how exactly does it works?
What if I want to keep a script but don’t want it to start automaticly?
Say I have a /etc/init.d/varnishand want to disable it temporary. How do I make sure it doesn’t start if the…
View On WordPress
Fixed: Running arbitrary program as daemon from init script #development #computers #fix
Fixed: Running arbitrary program as daemon from init script #development #computers #fix
Running arbitrary program as daemon from init script
I need to install a program as a service in Red Hat. It doesn’t background itself, manage its PID file, or manage its own logs. It just runs and prints to STDOUT and STDERR.
Using the standard init scripts as guides, I’ve developed the following:
#!/bin/bash # # /etc/rc.d/init.d/someprog # # Starts the someprog daemon # # chkconfig: 345 80 20…
View On WordPress