Questions tagged [init-script]

The scripts to be executed at boot, usually for starting deamons and mounting file systems.

325 questions
290
votes
2 answers

How to write startup script for Systemd?

I have 2 graphics cards on my laptop. One is IGP and another discrete. I've written a shell script to to turn off the discrete graphics card. How can I convert it to systemd script to run it at start-up?
Sharique
  • 3,113
  • 3
  • 16
  • 8
174
votes
2 answers

How does systemd use /etc/init.d scripts?

I just switched to debian jessie, and most things run okay, including my graphical display manager wdm. The thing is, I just don't understand how this works. Obviously my /etc/init.d/wdm script is called, because when I put an early exit in there,…
Martin Drautzburg
  • 2,498
  • 3
  • 16
  • 18
121
votes
4 answers

How can I make a script in /etc/init.d start at boot?

I think I read something a while back about this, but I can't remember how it's done. Essentially, I have a service in /etc/init.d which I'd like to start automatically at boot time. I remember it has something to do with symlinking the script…
Naftuli Kay
  • 38,686
  • 85
  • 220
  • 311
60
votes
3 answers

How to make unix service see environment variables?

I have set my environment variable using /etc/profile: export VAR=/home/userhome Then if I do echo $VAR it shows /home/userhome But when I put reference to this variable into the /etc/init.d/servicename file, it cannot find this variable. When I…
altern
  • 1,900
  • 3
  • 18
  • 20
57
votes
3 answers

Running a script during booting/startup; init.d vs cron @reboot

I am currently trying to understand the difference between init.d and cron @reboot for running a script at startup/booting of the system. The use of @reboot (this method was mentioned in this forum by hs.chandra) is some what simpler, by simply…
3kstc
  • 4,616
  • 15
  • 33
  • 49
44
votes
3 answers

The rc0.d,rc1.d,... directories in /etc

I'm running Ubuntu where I have the directories /etc/rc0.d, /etc/rc1.d, /etc/rc2.d, ..., /etc/rc6.d. Example files from my machine: directory example symlinks in the dir ------------------------------------------ /etc/rc1.d: K76dovecot,…
roger.james
  • 555
  • 1
  • 5
  • 6
26
votes
6 answers

No such file or directory /etc/init.d/functions

I created a startup script to start/restart/stop a group of applications. I used the lib /etc/init.d/functions in my script. It is working well on my system, but it not working for my client; he is getting the error: No such file or directory…
tecman
  • 363
  • 1
  • 3
  • 5
26
votes
2 answers

How can I make this daemon/init run as a non root user?

I have an init script to kick off a daemon. The problem is it runs as root. I would like it to run as a user called "deploy". Ubuntu 12.04 #! /bin/sh # File: /etc/init.d/unicorn ### BEGIN INIT INFO # Provides: unicorn # Required-Start:…
CT.
  • 413
  • 1
  • 5
  • 6
26
votes
4 answers

What's the connection between "/etc/init.d" and "/etc/rcX.d" directories in Linux?

I am learning command line from a book called "Linux Command Line and Shell Scripting Bible, Second Edition." The book states this: Some Linux implementations contain a table of processes to start automatically on bootup. On Linux systems, this…
its_me
  • 13,709
  • 23
  • 54
  • 52
23
votes
1 answer

What sets systemd apart from other init systems?

It is not quite official but it looks like systemd is coming to Debian and after reading some of the heated mailing list discussion on that decision, I am curious about the polarizing nature of systemd among linux users. I run Debian (sysvinit) and…
casey
  • 14,584
  • 5
  • 45
  • 62
21
votes
8 answers

hostapd will not start via "service" -- but will start directly

I am having trouble getting hostapd to start as a service. It fails when I try to start it: $ sudo service hostapd start [FAIL] Starting advanced IEEE 802.11 management: hostapd failed! From what I understand, this uses the configuration in…
gnychis
  • 311
  • 1
  • 2
  • 5
20
votes
1 answer

Confused about /etc/init.d vs. /lib/systemd/system services

I am trying to run MongoDB on a Debian 8.5 machine. When I installed the package (pre-built from percona.com), I noticed the following files: /etc/init.d/mongod (1) /lib/systemd/system/mongod.service (2) I understand that /etc/init.d/mongod is…
natario
  • 303
  • 1
  • 2
  • 5
19
votes
8 answers

/etc/rc.d vs /etc/init.d

Is ubuntu's /etc/init.d directory exactly equivalent (functionally) to what I presume to be the more standard /etc/rc.d/ (at least on arch)? Is there any particular reason canonical used init.d instead of rc.d for startup scripts?
Falmarri
  • 12,897
  • 17
  • 58
  • 71
19
votes
1 answer

unable to install anything using apt-get because of insserv

Whenever I try to install something using apt-get I get the error messages involving insserv. I have tried install many different packages but everything give same error. And apparently, CUPS package is doing/has done something because every error…
Pranjal
  • 385
  • 2
  • 4
  • 8
16
votes
2 answers

Can the init process be a shell script in Linux?

I was going through a tutorial on setting up a custom initramfs where it states: The only thing that is missing is /init, the executable in the root of the initramfs that is executed by the kernel once it is loaded. Because sys-apps/busybox…
TheMeaningfulEngineer
  • 5,735
  • 15
  • 64
  • 113
1
2 3
21 22