The init.d directory contains a number of start/stop scripts for various services on a Linux system.
Questions tagged [init.d]
352 questions
3
votes
2 answers
Spring Boot (Tomcat) based application as daemon - howto stop?
I wrote a Spring Boot webservice that uses an embedded tomcat as container.
In case the system reboots I want to backup some information to a mysql database.
In my webservice I use @Scheduled() and @PreDestroy to run the backup.
This goes well…

Alex
- 1,141
- 1
- 13
- 24
3
votes
1 answer
How to make my init.d script change users
I have this script which I would like to switch to the user "terraria" before starting the daemon. I can't figure out how to do it. My research brings me to bash scripts using su my_user -c, but I don't think that works in this case.
#!/bin/bash
#…

Drexl
- 69
- 2
- 2
- 8
3
votes
2 answers
Bash scripting - writing an init.d script
I'm using /etc/init.d/httpd as a template for an init.d script. I understand everything that is going on in the file except the following line:
LANG=$HTTPD_LANG daemon --pidfile=${pidfile} $httpd $OPTIONS
Can somebody explain why HTTPD_LANG (which…

user2759991
- 138
- 6
3
votes
1 answer
init.d: starting mplayer via "start-stop-daemon"
with an Ubuntu machine I'd like to run MPlayer like a daemon.
In foreground the following configuration is exactly what I need:
mplayer -slave -idle -input file=/tmp/mplayercontrol.
Now, I wrote the following script:
# /etc/init.d/mplayerd
### BEGIN…

Fabio Mora
- 5,339
- 2
- 20
- 30
3
votes
2 answers
daemonizing celery process celeryd-multi not found
I'm trying to daemonize the celery process for django running inside a virtualenv. I copied the celeryd file from https://github.com/celery/celery/tree/master/extra/generic-init.d to /etc/init.d/
I then created a config file with the contents at…

manu
- 1,072
- 1
- 14
- 26
3
votes
2 answers
Erlang: daemon 'init.d' script fails to start
I have a python script which manages an Erlang daemon. Everything works fine when used through a shell once the system is initialized.
Now, when I included the same script under "/etc/init.d" and with the symlinks properly set in "/etc/rcX.d", the…

jldupont
- 93,734
- 56
- 203
- 318
3
votes
5 answers
Daemonizing a python script in debian
I have a python script that i want to run in the background on startup. This is the script:
#!/usr/bin/python
from Adafruit_CharLCD import Adafruit_CharLCD
from subprocess import *
from time import sleep, strftime
from datetime import datetime
from…

Joseph Roberts
- 569
- 3
- 10
- 29
2
votes
3 answers
How do I support multiple server.pid files?
I am running play on multiple machines in our datacenter. We loadbalance the hell out of everything. On each play node/VM I'm using Apache and an init.d/play script to start and stop the play service.
The problem is that our play websites are hosted…

Joshua Gunder
- 235
- 2
- 9
2
votes
1 answer
how to autorun a shell script after boot - OpenWRT
i just got interested in OpenWRT and want to try somethings.
i'm trying to run a script right after my OpenWRT boots.
here is my script file
customchain.sh
#!/bin/sh /etc/rc.common
START=99
start(){
[my custom chains]
}
i've placed this script…

Popsicle
- 61
- 8
2
votes
1 answer
Log output from service in /var/log/ (sysvinit)
I have an init.d script that runs a binary as a daemon. The binary regularly writes status lines to stdout. I would like to log those lines into /var/log/my-daemon.
When the start code is like this:
start-stop-daemon -S -x $DAEMON -- $ARGS
And I…

JonasVautherin
- 7,297
- 6
- 49
- 95
2
votes
1 answer
Considerations for building SysV or Upstart compatible Bash scripts
I've just knocked out a quick script for keeping a slave web server in sync with a master using rsync. (https://github.com/simonjgreen/liveFolderSync/blob/master/liveFolderSync.sh)
I'd like to make this run on boot and be controllable via the usual…

SimonJGreen
- 273
- 1
- 19
2
votes
1 answer
Better script to restart mysql on Ubuntu 8.04
When I say sudo /etc/init.d/mysql restart on Ubuntu 8.04.2 sometimes there remains a mysql_safe process eating 99% of cpu. Making the machine practically unusable.
Is there a better way to restart mysql? I thought about writing a script:
sudo…

Karl Thorwald
- 341
- 1
- 4
- 15
2
votes
1 answer
How can I run a service inside a docker container to get feed from a IDS uEye camera using gstreamer?
I have a docker container that uses a gstreamer plugin to capture the input of a camera. It runs fine with a Bastler camera but now I need to use an IDS uEye camera. To be able to use this camera I need to have the ueyeusbdrc service running. The…

tgonzalez89
- 621
- 1
- 6
- 26
2
votes
2 answers
Why would you set the same values in Required-start as you did for Required-stop in a init.d script?
The Debian wiki gives the following example for 'INIT INFO`:
### BEGIN INIT INFO
# Provides: scriptname
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1…

Kit Sunde
- 35,972
- 25
- 125
- 179
2
votes
2 answers
Debian execute springboot app as service: service not found
I follow this doc: https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#deployment-initd-service
My app repo:
└──╼ ls -l
total 67556
-rw-r--r-- 1 root root 1842 nov. 7 15:06 application.yml
-rw-r--r-- 1 root root 69169161…

Tyvain
- 2,640
- 6
- 36
- 70