init-script

Stop not called for init rc.d service

Stop not called for init rc.d service I have a very simple SysVinit service in /etc/rc.d: #!/bin/bash PIDFILE="/var/run/test.pid" status() { if [ -f "$PIDFILE" ]; then echo ‘Service running’ return 1 fi return 0 } start() { if [ -f "$PIDFILE" ] && kill -0 "$(cat "$PIDFILE")"; then echo ‘Service already running’ return 1 fi …

Total answers: 1

How to execute wine command through busbox?

How to execute wine command through busbox? I am building minimal operating system using busybox.I am writing init file, I want to call script1.sh file from init file. Challenges I am facing are: After running init file it is showing ./script1.sh : not found In script1.sh it has wine command which calls .exe, I am …

Total answers: 1

How to integrate C program with init file?

How to integrate C program with init file? So I am working on building minimal os using busybox. What I want is I want to run my .net program from BIOS. But I am not sure linux will run .net program or not, so to clear my path I am using C program instead of …

Total answers: 1

Bash script error on boot

Bash script error on boot I have to tune my laptop’s keyboard behaviour by lowering its brightness timeout, so I placed a one-line command in a script file, executed at boot. Here is it: $ cat /usr/local/bin/boot-script.sh #!/bin/bash echo "10s" | sudo tee /sys/devices/platform/dell-laptop/leds/dell::kbd_backlight/stop_timeout Unfortunately, I get an error on boot saying: machi boot-script.sh[362]: tee: …

Total answers: 1

syslog message at boot: uninitialized urandom read

syslog message at boot: uninitialized urandom read CPU is AMD GX-412TC SOC: GX-412TC GE412TIYJ44JB 4 6W 2MB 1.0GHz/ 1.4GHz N/A N/A DDR-1333 0-90°C which does not have rdrand: grep rdrand /proc/cpuinfo # nothing I see following messages in my syslog after machine boot: kernel: random: dd: uninitialized urandom read (512 bytes read) kernel: random: cryptsetup: …

Total answers: 2

Can I make Qemu exit with failure on kernel panic?

Can I make Qemu exit with failure on kernel panic? I’m trying to add Qemu to my continuous integration pipeline to test various initrd artifacts. I’ve already discovered that I can run Qemu like this: qemu-system-x86_64 -machine q35 -drive if=pflash,format=raw,file=OVMF_CODE.fd,readonly -drive if=pflash,format=raw,file=OVMF_VARS.fd -kernel vmlinuz-4.4.0-121-generic -initrd my-initramfs.cpio.xz -nographic …and cause qemu-system-x86_64 to exit with status 0 …

Total answers: 2

systemd: finish the execution of custom shell script before starting nginx

systemd: finish the execution of custom shell script before starting nginx Using Debian 9 stable, I want to start a custom shell script before starting NGINX processes and shorewall firewall: Do some init work Mount a directory (overlayfs) to overlay /etc with NGINX configuration, shorewall configuration and /etc/hosts The script also ends with sync, not …

Total answers: 2

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

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 called at boot, or in other particular system states, as long as it is registered via …

Total answers: 1

unable to install anything using apt-get because of insserv

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 message involves it. The following are the errors …

Total answers: 1

systemd: running a script on shutdown after filesystems are mounted read-only

systemd: running a script on shutdown after filesystems are mounted read-only Is there a way to run a script on shutdown, after the file system is remounted as read-only? I’ve a raspberry pi connected to a wireless socket, which I can control via a sender and a script. I want to power off that socket …

Total answers: 2

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

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, wdm is not started. But when I …

Total answers: 2

What is the meaning/purpose of *.pid files in /var/run

What is the meaning/purpose of *.pid files in /var/run I’m quite new in Linux world, and now I’m trying to understand FHS principles. In /var/run I found about ten *.pid files like crond.pid which contain just PIDs. There are more than ten processes running in the system and just ten files. So what is their …

Total answers: 1

Run automatically Noip2 when the machine is booted?

Run automatically Noip2 when the machine is booted? I put the following script in /etc/init.d/rc3.d on my Debian 7 but it doesn’t work on my computer #! /bin/sh # . /etc/rc.d/init.d/functions # uncomment/modify for your killproc case “$1” in start) echo “Starting noip2.” /usr/local/bin/noip2 ;; stop) echo -n “Shutting down noip2.” killproc -TERM /usr/local/bin/noip2 ;; …

Total answers: 2

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

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 going into crontab -e and …

Total answers: 3

systemd: default value for environment variable

systemd: default value for environment variable I would like to migrate some OpenRC init script to systemd but I think that it is general problem of environment variables handling in systemd. Original OpenRC files There is a file e.g. /etc/conf.d/fooservice with contents # value of FOO variable # you can override default value by uncomenting …

Total answers: 1

Can the init process be a shell script in Linux?

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 includes a …

Total answers: 2

What does the hyphen mean in chkconfig run level in an /etc/init.d script?

What does the hyphen mean in chkconfig run level in an /etc/init.d script? I just have a simple question but scouring the search engines I have not found any explanation of what the – (hyphen) in the chkconfig runlevel actually stands for within the init script file. For example in /etc/init.d/mysqld the first few lines …

Total answers: 1

Minimal Linux with kernel and BusyBox: /etc/inittab is ignored, only /init is executed

Minimal Linux with kernel and BusyBox: /etc/inittab is ignored, only /init is executed I managed to create a small and fully functional live Linux CD which contains only kernel (compiled with default options) and BusyBox (compiled with default options + static, all applets present, including /sbin/init). I had no issues to create initrd and populate …

Total answers: 1

Should "invoke-rc.d" or "service" be used to restart services?

Should "invoke-rc.d" or "service" be used to restart services? I’m confused as to which is best and in which circumstances: invoke-rc.d apache2 restart or service apache2 restart Is there a real difference? man service has the following interesting bit: service runs a System V init script in as predictable environment as possible, removing most environment …

Total answers: 2

BASH_ENV and cron jobs

BASH_ENV and cron jobs I have several questions related to non-interactive, non-login shells and cron jobs. Q1. I have read that non-interactive, non-login shells only “load” $BASH_ENV. What does this exactly mean? Does it mean that I can point $BASH_ENV to a file, and that this file will be sourced? Q2: Assuming that I have …

Total answers: 1