Tag Info

Hot answers tagged

15

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


9

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


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

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


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

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 ...


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

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


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

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 ...


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

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

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

/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

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

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

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

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

/etc/rc.local gets executed on each boot, after all the other init scripts run. That would be another easy-to-implement option.


3

How to configure networking depends on the distribution you use. On a Red Hat based system you will find those configs in /etc/sysconfig/networking/, Debian based systems store them in /etc/network/interfaces, Gentoo stores it in /etc/conf.d/net and Arch Linux like BSD under /etc/rc.conf. Which distribution of GNU/Linux do you use? The cannonical path to ...


3

Look into the command update-rc.d, which is the standard Debian/Ubuntu way to set up starting and halting of services. The file /etc/init.d/skeleton is also a quite nice template for making your own services quickly and with correct behaviour.


3

The existing SysInit system would handle that for you just fine. Ubuntu has docs on what they are doing with these. Yes, they are switching to upstart.


3

If your programs are running in the foreground, I suggest Runit, which is a replacement for the previously-mentioned daemontools, and is also a replacement for Sys-V style init. On Ubuntu, Runit is available as a package and has the necessary scripts to be started at system boot by Upstart. We use Runit for all non-system-installed packages, such as Rails ...



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