Hot answers tagged init
104
Currently there are actually 2 different ways for software to be started as a service in Ubuntu. A service is defined here as a program run by the system in the background, as opposed to one started and run directly by the user.
The traditional way to start services in Linux was to place a script in /etc/init.d, and then use the update-rc.d command (or in ...
88
I can show you several ways. There are services that can be enable/disable using the GUI (Like Gnome) and then other ways of doing the the same through the terminal. Since we are talking about Ubuntu and Ubuntu is quickly moving to Upstart (At least most is in Upstart job format) I will mention the way to do it via Upstart.
At least this way, for future ...
30
/etc/init.d contains scripts used by the System V init tools (SysVinit). This is the traditional service management package for Linux, containing the init program (the first process that is run when the kernel has finished initializing¹) as well as some infrastructure to start and stop services and configure them. Specifically, files in /etc/init.d are shell ...
21
For those of us who run Ubuntu over ssh, I think the nicest option is rcconf - a command line ASCII GUI:
sudo apt-get install rcconf
sudo rcconf
Navigate with tab and arrow keys, press spacebar to enable/disable. Changes are persistent across restarts.
Screenshot borrowed from this blogpost, which also shows sysv-rc-conf - a similar tool that also ...
18
The solution is to approach the problem from the other direction: to satisfy the start criteria for Centrify, it is not necessary to make existing services
depend on the new Centrify service, rather make the new Centrify service
depend on existing services.
For example, an Upstart configuration file /etc/init/centrify.conf could say:
start on (starting ...
16
Try using sysv-rc-conf
sudo apt-get install sysv-rc-conf
and to start managing the services, execute
sudo sysv-rc-conf
Which will bring up interactive window like this
You can further navigate through pages using Ctrl+n for next page and Ctrl+p for previous page .You can enable and disable services by selecting SPACE on desired runlevels.
Another ...
10
There is really never any compelling reason to use init 6 instead of reboot, unless:
For some reason you are missing the reboot executable, or
You are deliberately trying to avoid notifying users that the system is going down.
reboot (so long as you don't run reboot --force) is actually the "softer" way to shut down.
Consider:
init 6 will run all of ...
7
You cannot make a script that runs from init.d and displays a gnome-terminal window, because scripts in init.d run before there is any login session in which to display one. They run even before the graphical user interface is running.
Logging to a File Instead
If you need to run this script when the machine boots up, then instead of trying to make it ...
7
From Bellum PLC Forum - Ubuntu 11.10 init 100% cpu usage bug:
I noticed an CPU usage issue with init due to upstart, Which was eating 99% ram constantly. and i decided to find working fix.
This is a bug which has been confirmed by Ubuntu but below is a simple quick fix patch which should work completely for all.
Firstly Open up SSH and add the ...
6
Upstart is the replacement for the traditional init.d style System-V bootup scripts. However, upstart is more than just a collection of bootup scripts. It allows in fact a minute planning and control of the start of different daemons. For instance, in order to automount network drives, you need first a working network. While before upstart these situations ...
6
Marty Fried's answer contains the one most valuable info: the Cookbook. Reading thru that makes you more than able to write your init scripts.
However, messing with init.d, rc*.d, chkconfig et al, is not what you want to do. On Ubuntu (and other distros), they're just remains of the old sysvinit stuff which many packages still use or just support for legacy ...
5
As you point out, the ".d" nomenclature is puzzling and strange, and doesn't really have any place in any modern system -- you'll notice that most modern services have tended to drop it.
The reason the directory is /etc/init and not /etc/upstart is because Upstart is the project name, the actual installed binary is still /sbin/init thus it would not make ...
5
James's answer works for a 1 to 1 dependency. For a 1 to many, i.e., to make sure service A starts before services B, C, and D, you need to take another approach. You can look at the current portmap scripts for reference but here is the general approach: create a wait script.
Scenario: you want your Service A to always run before service-b, service-c, and ...
5
It usually means you have an error in the .conf file - for instance I'm not sure the pid stanza is supported in 10.04, stop can't be used in the script etc.
I'd try starting the file from scratch (with only start, stop etc), and then slowly building it up by adding more and more lines and testing it via start pure-ftpd.
For example:
# cat pure-ftpd.conf
...
5
The most relevant reference for job file syntax will be available when you run the command:
man 5 init
on your system. For Ubuntu 10.04, as you found in the previous answer, the pid file syntax is incorrect.
Any time you get that 'unknown job" error back, its a good idea to check the logs (pre 11.04, /var/log/daemon.log, 11.04 and greater everything goes ...
4
If you do man inittab in your terminal, all shall be revealed:
The /etc/inittab file was the configuration file used by the original
System V init(8) daemon.
The Upstart init(8) daemon does not use this file, and instead reads
its configuration from files in /etc/init. See init(5) for more
details.
4
Check the jenkins upstart configuration file /etc/init/jenkins.conf.
Verify that the path for JAVA_HOME is correct. On a fresh install, it may look like /usr/lib/jvm/java-default (or default-java), however, if you've used apt-get to install the java 6 jre, the directory is actually /usr/lib/jvm/java-6-sun
4
From here you add wireless-mode ad-hoc to your interface definition
auto wlan0
iface wlan0 inet static
address 192.168.1.1
netmask 255.255.255.0
wireless-channel 1
wireless-essid MYNETWORK
wireless-mode ad-hoc
4
The setting I am looking for is in /etc/default/rcS, FSCKFIX=yes. This means "automatically repair filesystems with inconsistencies during boot" and causes fsck to run with the -y flag. It was set to no in both of my Ubuntu systems.
Even when set to no, the boot time fsck is still somewhat noninteractive. mountall runs fsck with -a, a synonym for -p, which ...
4
dpkg --get-selections should return nothing for packages that are not installed. The fact that it is returning something is a symptom that there are parts of the package that have not been removed.
If you try --list instead of --get-selections, you'll see the reason why the package is not fully removed. In your case, you should see rc near mythtv-backend, ...
3
I don't trust anything but the kernel to keep a sane state here, so I don't (ab)use init to get this job done, nor do I count on myself actually knowing what is or isn't mounted (some packages can mount extra filesystems, like binfmt_misc). So, for process slaughter, I use:
PREFIX=/mnt/chroot-0
FOUND=0
for ROOT in /proc/*/root; do
LINK=$(readlink ...
3
I experienced a similar problem. It seems that recent ubuntu livecds have the bad behaviour to access the disk partitions at startup, and make them busy if they are not fsck clean.
The solution I found was to run the fsck on that partition starting with a different diagnostic livecd, in particular I used finnix, a Debian derivative.
3
Use Upstart as the System V Init scripts are being deprecated and its simpler.
Simply place this file my_script.conf into /etc/init
# Start when pc starts up
start on runlevel [2345]
# Stop when pc shuts down
stop on runlevel [016]
# Start Script
exec my_start_script
# Stop Script
pre-stop my_stop_script
The Pre Stop will script contain code to kill ...
3
Try the steps listed in this page:
How to Fix an Ubuntu Error: "No init found. Try passing init= bootarg"
Basically,
Reboot with a live CD
sudo fdisk -l
will get you the name of the disk then
sudo fsck /dev/sda
3
Most of the time you can cut out a lot of the code in those scripts and just focus on running the the main program. If you can tell it to run in the foreground instead of the background that will make things simpler. Otherwise you have to use 'expect fork' or 'expect daemon' to follow the forks that a program must do to detach from controlling terminals.
...
3
Jaunty is no longer supported (it reached End-Of-Life last month), so I would recommend upgrading (go to 10.04 if you need a long-lived system). However, when you upgrade to a version that uses Upstart, you can create a file in the /etc/init directory to do what you need. For example, create /etc/init/sheevaplug.conf:
start on stopped rc RUNLEVEL=[123456]
...
3
I've just commented in the github issue as well.
Since there seems to be some issue with setpgrp and gunicorn, you may have better results if you run it with
expect fork
Added to the upstart job definition.
so something like
start on runlevel [2345]
stop on runlevel [!2345]
respawn
expect fork
exec /path/to/gunicorn --daemon
Should work well.
'man ...
2
We just pushed a patch to Gunicorn master [1] that will allow you to use Gunicorn with Upstart. You shouldn't need to use any of the "expect fork" configuration directives with this version.
[1] https://github.com/benoitc/gunicorn
Only top voted, non community-wiki answers of a minimum length are eligible