Tag Info

Hot answers tagged

17

Add the --make-pidfile option to your call of start-stop-daemon. --pidfile only tells start-stop-daemon where to look for the pidfile, without --make-pidfile it is assume that this pidfile is created by the program to be launched, and not by start-stop-daemon. Be sure to read the manpage of start-stop-daemon(8) for more details.


10

This should do the trick : update-rc.d apache2 disable Basically update-rc.d will modify existing runlevel links for the script /etc/init.d/apache2 by renaming start links to stop links. If you wanted to disable only runlevel 2 and 5, you could do : update-rc.d apache2 disable 2 5 nico


10

Figured it out, I needed to wait for a specific device, here's my working Upstart job file: description "SSH Tunnel" start on (net-device-up IFACE=eth0) stop on runlevel[016] respawn env DISPLAY=:0.0 exec autossh -nNT -o ServerAliveInterval=15 -R 22100:localhost:22 myuser@myserver.com -p 2201


10

In short: ls /etc/rc*.d This shows you what starts at which runlevel, and within each level the order is determined by the number after the letter (K is Kill, S is start). You can configure what starts at each runlevel with sysv-rc-conf, which is installable with apt. e.g. on my system apache2 is symlinked in rc5.d as "S20apache2". A link in the same ...


9

enable bootlogd, which is part of sysvinit-utils by setting BOOTLOGD_ENABLE=Yes in /etc/default/bootlogd which will log in /var/log/boot. In wheezy and beyond bootlogd is in its own package and will not have /etc/default/bootlogd


9

You could use cron and the @reboot flag to schedule the shutdown if you add this to the root crontab: @reboot shutdown -h +30


9

The common set is simply 755 even though only root should be running them. So: chmod 0755 <file>


8

Currently, Upstart in Ubuntu does not generate network events. Instead it calls traditional sysvinit. By default NetworkManager is installed and running; rather than emit network events to upstart, it contains a run-parts dispatcher (/etc/NetworkManager/dispatcher.d/) which itself simply relies on ifupdown's run-parts dispatcher (/etc/network/*.d/). In ...


8

I created the following script #!/bin/bash date who -r /sbin/telinit 2 who -r /sbin/telinit 3 who -r date and installed it in cron * * * * * /home/iain/test &>>/tmp/test.out It's output Thu Mar 20 03:06:01 EDT 2014 run-level 3 2014-03-20 03:05 last=2 run-level 2 2014-03-20 03:06 ...


7

On most modern Linux systems, you should be able to configure the network settings in some config file (Manuel gave some good locations) and the system will take care of executing the relevant commands (like ifconfig and dhclient) for you. If this is CentOS, you shoud probably set the following in /etc/sysconfig/networking/devices/ifcfg-eth0: ...


6

daemontools is indeed well proven; the license isn't even problematic anymore, I don't think. And its FAQ compares it to inittab, which you asked about.


6

Use monit, it's more secure than writing a shell script for that. If you are really want to write a script, use curl to get the content, grep it and restart the service in case of fail.


6

iniscripts can do whatever they want. Of course it makes sense not to introduce new dependencies, just for the initscripts. grep however is fine on pretty much any system that's posix/susv3 compatible (linux, bsd, solaris, other derivatives). For more utilities that should always be there, see ...


5

On an older HP-UX system, we used to do cold backups of our databases nightly using runlevel changes. We had the database start and stop at runlevel 4, and basically did an telinit 3, took snapshots of the disks, telinit 4, started backing up the disks. It's a slightly different strategy than your looking at, but for all intents and purposes, it'll behave ...


5

The way you disable a service under just about any RedHat-derived distribution is with the chkconfig command: # chkconfig httpd off And to stop a running service: # service httpd stop These commands will Do the Right Thing regardless of whether your system is running systemd, upstart, or vanilla SysVInit. For what it's worth, despite running upstart ...


5

sysv-rc-conf is the new way to do this job.


5

David, run-levels 1 and s are equivalent. The main difference between these two commands is that reboot will reset the system, bringing it up in as clean a state as possible, while "init s" will just go down to single user without resetting the system - this is possibly quicker, but potentially may leave "cruft" around (any processes lacking an utmpx entry ...


4

Your question basically includes the answer.... A script that'll iterate through a subdir of each users home, looking for executable scripts. Then it sudo -u user /export/home/user/scripts/scriptname.sh start. You'll have no control over what the scripts do, so you`ll need to trust your users. Insist that they write their scripts to accept stop start ...


4

Since this sounds like a run-and-be-done script I would say that /etc/rc.local or cron (time: @reboot) is definitely the way to go. On the other hand, anything which will stay daemonized should definitely has its own init script. If nothing else, to make sure it shuts down properly.


4

Yes, yes it will. Most services don't run in runlevel 1.


4

Create the following script /etc/init.d/irc_notify ### BEGIN INIT INFO # Provides: irc_notifications # Required-Start: $network # Required-Stop: # Default-Start: 3 5 # Default-Stop: 0 1 2 6 # Short-Description: IRC Notifications # Description: Simple script to send notifications to IRC ### END INIT INFO #!/bin/bash case "$1" in ...


4

/etc/init.d contains the launch scripts, but doesn't actually tell each runlevel what it should do. The actual scripts are called as symlinks from /etc/rc[0-6].d where [0-6] is the runlevel you're entering. More specifically, the symlinks are given the name: [SK]nnScript where [SK] is Start or Kill, nn is the order (lower first) and Script is the name of ...


4

I don't have that version of Fedora but for RHEL5 the important part of /etc/rc.d/rc is: subsys=${i#/etc/rc$runlevel.d/K??} [ -f /var/lock/subsys/$subsys -o -f /var/lock/subsys/$subsys.init ] \ || continue Your problem may be that you don't touch a /var/lock/subsys/blueBox when starting. Also the file in init.d is called blueBoxT whereas your ...


4

Answer I It's just a shorthand notation. Here: [ ${NETWORKING} = "no" ] && exit 1 It checks if ${NETWORKING} is set to "no". If this returns false (networking is enabled) then the second part does not get evaluated (exit 1), because it's already false (&&, logical conjunction). The other way round goes: [ -x /usr/sbin/vsftpd ] || exit ...


4

Would rcconf and sysv-rc-conf utilities help? # aptitude install rcconf sysv-rc-conf Afterwards you can run them by typing rcconf or sysv-rc-conf.


4

Try this: /var/customDaemon >> /var/log/customDaemon.log 2>&1 & I suggest you should running the service with normal user instead of root. To show the [ OK ], [ FAILED ] messages, you can check the exit status, something like this: /var/customDaemon >> /var/log/customDaemon.log 2>&1 & RETVAL=$? [ $RETVAL = 0 ] ...


3

The problem is that after your process seems to be terminating by itself. We don't have the log message for the process with pid 2083 but I suspect it died unexpectedly before you issued the next 'initctl restart pref' (like how pids 2128 and 2133 died for example). The key is that 'initctl restart foo' ONLY WORKS if the foo job name is still running. If it ...


3

sudo: Sorry, you must have a tty to run sudo Run visudo and add the following line to disable requiretty for your user: Defaults:username !requiretty


3

I've spent some more time on Google and as a result of an argument for another answer, read through the startup scrips. This turns out to be quite simple: Disabling the old cluster Under the config files for each cluster (/etc/postgresql/<version>/<cluster>/) there is a file called start.conf. This contains just one uncommented word - auto. ...


3

I suspect you're running Ubuntu Lucid (10.04)? init-checkconf was introduced in Ubuntu Natty (11.04): https://wiki.ubuntu.com/NattyNarwhal/TechnicalOverviewUpstart Note that it is possible to build a more recent version of Upstart for Lucid, but there is no officially packaged version. Note that it is not just a case of compiling upstart, you would also ...



Only top voted, non community-wiki answers of a minimum length are eligible