17
votes
Can I make Qemu exit with failure on kernel panic?
QEMU -no-reboot + kernel CLI panic=-1
qemu-system-X -no-reboot QEMU CLI option: makes QEMU exit when the guest tries to reboot
panic=-1 kernel boot parameter: makes Linux try to reboot immediately ...
8
votes
Accepted
Running a sudo command automatically on startup
If your system is using systemd, that is your best option for what you want to do. The systemd unit will already be executed as root, so sudo is not needed, and you can set it up to run during bootup ...
7
votes
Accepted
Can I make Qemu exit with failure on kernel panic?
I've got something that's working:
Configure (and build) the kernel with CONFIG_PVPANIC=y; this produces a kernel with compiled-in support for the pvpanic device.
Invoke qemu-system-x86_64 with the -...
7
votes
Catch-all command to restart display manager?
If you are using Debian (and derivatives like ubuntu), /etc/X11/default-display-manager should contain the name of the currently active display manager.
So something like that should work:
dm=$(...
7
votes
Accepted
What do programs use to read their environment?
programs get their environment from the third argument of the execve(program_path, argv, envp) system call that executed them.
envp, like argv is an array of strings, except for envp by convention the ...
6
votes
Can systemctl list all enabled services, including legacy services?
I believe the command you want is:
systemctl list-units --type service --all
This from my test lists all service even those from legacy boot services.
Source:
https://access.redhat.com/...
6
votes
Accepted
systemd failing to recognize pid file
systemd parses an init script's comments to generate temporary .service file at boot or upon daemon-reload command. Change the line
# pidfile: /var/run/ossec-authd.pid
to
# pidfile: /var/ossec/var/...
6
votes
Can the init process be a shell script in Linux?
The exec syscall of the Linux kernel underestands shebangs natively
When the executed file starts with the magic bytes #!, they tell the kernel to use #!/bin/sh as:
do and exec system call
with ...
6
votes
How can I make a script in /etc/init.d start at boot?
In this answer, let's assume I want to mount Windows Shares (CIFS) defined in /etc/fstab via mount -a -t cifs via a service script on an Ubuntu system. First, I create an entry under /etc/init.d/...
6
votes
Accepted
systemd: finish the execution of custom shell script before starting nginx
If you don't specify the type of your systemd service, it defaults to Type=simple. This means the service is considered started at the moment its main service process has been forked off (at which ...
5
votes
Accepted
Writing start script with different working directory
Make the startup script do the cd before running mjpg_streamer, just like you're doing manually:
#!/bin/sh
cd /home/geilisa/mjpg-streamer
./mjpg_streamer -i "./input_raspicam.so -fps 5" -o "./...
5
votes
Systemd service creation of Prometheus and Node Exporter
I solved the problem like this...
Node exporter:
ExecStart=/bin/sh -c '/usr/local/bin/node_exporter'
Mysql_exporter:
=/bin/sh -c '/usr/local/bin/mysqld_exporter \
--config.my-cnf /etc/....
5
votes
Run automatically Noip2 when the machine is booted?
Here is a more straightforward way to approach this...
We are trying to mimic your regular user account issuing this command (assuming you followed No-IP's recommended setup instructions) ...
sudo ...
5
votes
Start a Qt/wayland application on top of weston on startup
Typically it's not about starting Weston on a specific tty, but about having the environment variables set which will route you to the proper instances of Wayland and Weston. These variables are such ...
5
votes
syslog message at boot: uninitialized urandom read
Your diagnosis is correct: a read was attempted on an empty entropy pool. This is "boot time entropy starvation".
You can either leverage systemd-boot if you have an EFI system, ignore the ...
4
votes
How to write startup script for Systemd?
Adding startup items in systemd is complex and cumbersome. To make this more convenient, I have wirte a tool add_service which provides a simple way to quickly add startup item in systemd.
Install:
...
3
votes
How to run a program on boot up?
You can use crontab for this.
Use crontab -e to edit user's crontab (A list of start-up scripts that users have added).
Add following line at the end:
@reboot <command>
Examples:
@reboot ...
3
votes
Migrate socat init script to systemd
For socat, I use a pure systemd approach. This is an example for a serial loopback:
[Unit]
Description=Socat Serial Loopback
#Before=my-other.service
[Service]
Type=simple
StandardOutput=syslog
...
3
votes
Init scripts invoking script on a user's directory -- not working (Ubuntu 18.04)
You are using Ubuntu Linux, an operating system that has been a systemd operating system since 2016 and was an Upstart operating system for a decade before that, since 2006. van Smoorenburg rc ...
2
votes
hostapd will not start via "service" -- but will start directly
Adding 10 seconds sleep in file /etc/init.d/hostapd fixed the problem for me.
1) sudo nano /etc/init.d/hostapd
2) Add the sleep in start) section like below
case "$1" in
start)
...
2
votes
Auto login into router running Busybox
Probably a slightly late answer, but I've decided to add it anyway.
Hanging at the Cisco logo (or whatever else) is the expected behaviour in the case when the /etc/inittab file is empty. The answer ...
2
votes
Systemd service creation of Prometheus and Node Exporter
It seems that the path node_exporter is not correct.
ExecStart=/usr/bin/node_exporter
I have another path to it on Ubuntu 16.04
~# cat /etc/issue
Ubuntu 16.04.3 LTS \n \l
~# which node_exporter
...
2
votes
systemd failing to recognize pid file
All of that is totally unnecessary.
The behaviour of systemd-sysv-generator with a van Smoorenburg rc script that has both the old RedHat comment headers and the LSB headers is interesting, but ...
2
votes
/etc/inittab respawn already running process, Debian9
The simple answer is: Don't do it this way.
If you want to have your process handled according to the configuration in /etc/inittab you must not start it manually or somewhere else.
init does not ...
2
votes
Nessus 8.13 Install on Kali or Ubuntu: /etc/init.d/nessusd: command not found
Use:
systemctl enable --now nessusd
Verify it:
systemctl status nessusd
You get an error because the service file is under:
/usr/lib/systemd/system/nessusd.service
and not /etc/init.d/
2
votes
Accepted
syslog message at boot: uninitialized urandom read
For haveged to work, it has to be compatible with your kernel — there's an issue with haveged not doing anything in kernel versions >=5.x, see is haveged still useful/relevant? #57 on GitHub.
The ...
2
votes
Accepted
How to schedule a period of time in which power-on or log-in is prevented?
Your operating system can’t prevent power-on; that would be controlled by the system firmware (but I’ve never seen anything like that).
You can force the system to power off if it’s switched on though,...
2
votes
Accepted
Why does this init.d script sometimes not run at shutdown?
why you dont try to use systemd to manage daemons, its easier and available since debian Jessie.
/etc/systemd/system/servicemysql.service
[Unit]
Description=MySQL task
DefaultDependencies=no
Conflicts=...
2
votes
Accepted
How to integrate C program with init file?
Your script is failing because you don’t have gcc in your initrd.
You should not ship hello.c in your initrd; you should build the program and ship that instead in your initrd. You should also specify ...
1
vote
wget saving files as emply plain text files on boot
Most likely the issue is that the network interface isn't up at the time cron tries to run your script.
You could make the script run after the network interface is up.
Put your script in /etc/...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
init-script × 327sysvinit × 97
linux × 46
debian × 44
systemd × 35
shell-script × 34
centos × 33
init × 32
boot × 26
services × 22
startup × 22
rhel × 21
bash × 20
ubuntu × 20
daemon × 15
shell × 12
networking × 9
scripting × 9
raspberry-pi × 8
environment-variables × 7
raspbian × 7
chkconfig × 7
fedora × 6
gentoo × 6
shutdown × 6