![]() |
#1 |
Member
![]() Posts: 12
Karma: 10
Join Date: May 2020
Device: Kindle Voyage
|
![]()
I have a background process that I'd like to run at boot. On Linux I'd typically do this with systemd, but obviously that's not an option. I know init.d can handle launching things, but it seems like most people use udev rules to run their background processes.
What are the different options I have to launch background processes at boot, and what are the pros/cons of each option? |
![]() |
![]() |
![]() |
#2 |
Linux User
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,282
Karma: 6123806
Join Date: Sep 2010
Location: Heidelberg, Germany
Device: none
|
you can run it with an udev rule, but udev might trigger it multiple times (so you need some locking mechanism) and there's also a case where long running scripts are terminated, so the scripts might need to daemonize itself too.
so almost all my mods do it this way... trigger by udev, setsid, lock. also your script may already run before kobo finished booting so the user partition maynot be mounted yet, so you have to wait for that too. example /etc/udev/rules.d/miniclock.rules Code:
KERNEL=="loop0", ACTION=="add", RUN+="/usr/local/MiniClock/miniclock.sh" Code:
#!/bin/sh # udev kills slow scripts udev_workarounds() { if [ "$SETSID" != "1" ] then SETSID=1 setsid "$0" "$@" & exit fi # udev might call twice mkdir /tmp/MiniClock || exit } # nickel stuff wait_for_nickel() { while ! pidof nickel || ! grep /mnt/onboard /proc/mounts do sleep 5 done } udev_workarounds wait_for_nickel # do your stuff past this point using udev rules is nice since you can just add those files. there's no need to modify existing files. you can tamper the Kobo's rc scripts too but if there are two different mods that want to do that, they might be in conflict with one another, and the risk of breaking the boot process is higher Last edited by frostschutz; 10-27-2021 at 04:02 AM. |
![]() |
![]() |
Advert | |
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Mac High Sierra : background process at boot | reinsley | Calibre | 2 | 02-05-2018 11:31 AM |
Make CC not start on boot | roadrunnerm | Calibre Companion | 4 | 04-08-2016 10:03 AM |
Calibre start at boot on Ubuntu 12.04 ? | user68 | Calibre | 2 | 06-08-2012 05:12 PM |
DR800 How to start a background process? | CoolDragon | iRex | 1 | 04-29-2010 04:16 PM |
Calibre appears in processes but does not start in vista | vrf3 | Calibre | 10 | 03-23-2009 01:06 AM |