You are not logged in.
I can find plenty of documentation on making it watch for the creation of a directory, but for what I intend to write I need it to watch for a certain directory being removed.
Namely, I want to watch for /usr/lib/modules/`uname -r` to be removed, and if so, move the backup copy I have created on each boot back into place. This way I can update the kernel without having to reboot, and won't have to remember to move the backup back into position each time on my own.
Barring that, is there a way to have systemd watch for a specific package to be installed? That way I can just have it run a script to take care of this any time it sees that linux-ck has been updated?
I've run search after search, but it's not giving me anything remotely relevant, aside from the documentation that tells how to do the exact opposite of what I want.
Offline
Why do you want systemd to do this? How about inotify?
Offline
Offline
#!/bin/sh
while true; do
inotifywait -e modify -e create -e delete \
/etc/nginx/sites-enabled
nginx -s reload
done
You could write script using notify-tools and launch via systemd.
YCH
Offline
@Karol, doesn't have to be systemd, just knew it could do similar actions, and I already know how easy it is to write service files for it.
@Falconidy I'm trying to fix it so that I don't have to manually update the linux packages, and those that depend on specific versions of it every time I run updates. This is the first distro I've run across that removes kernel modules necessary for the current running kernel to function. In fact, it's the first one I've seen that doesn't keep the last working kernel on upgrades. So far that's the only real beef I have with arch, and I've been pondering ways of remedying that situation. So far without futzing with pacman, the simplest solution I've seen is to (on each boot) create a copy of the current kernel's modules as /usr/local/lib/`uname -r`-bak, then if I notice linux gets updated run 'cp /usr/local/lib/`uname -r`{-bak,}'. As far as I recon, this also needs to be done with the extramodules directory, and the kernel sources installed from linux-headers. Otherwise, a reboot is required for adding new hw(ie thumb drives) or if kde needs to be restarted.
@YCH That looks promising, but wouldn't it drive my system load and/or io up constantly? Looking at it, my original idea would to though. Guess it's back to the drawing board.
Offline
okay .. got more coffee in me, and did some digging into inotify. Since I know this should only happen once, I don't need to do a loop. Just watch for it to be deleted that first time, and execute the move command. As long as something doesn't cause the need for me to re-install the current running kernel. Can do the same thing for extramodues, and /usr/src/linux-`uname -r` ...
Now I'm just wondering if that sounds utterly mad to anyone before I actually implement it...
Offline
If you need more than one event, you might want to look into the -m switch of inotifywait.
Offline
Halljordan,
make sure you write something to regularly remove older copies of the modules you put back, else the partition that holds /usr/lib may fill up very fast.
Last edited by Lone_Wolf (2014-02-13 11:50:01)
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline
inotifywait is just waiting till the event. There is no overhead during wait event. If you should monitor filesystem changes in linux, libnotify is the right way. while loop is just do that monitoring again when the event occur.
Just watch for it to be deleted that first time, and execute the move command.
That is exactly the job of inotify.
YCH
Offline
Are you sure it's libnotify?
https://www.archlinux.org/packages/comm … ols/files/
http://linux.die.net/man/1/inotifywait
http://linux.die.net/man/1/inotifywatch
Last edited by Awebb (2014-02-13 16:25:17)
Offline
You're right. It's `inotify-tools`.
YCH
Offline
okay .. got more coffee in me, and did some digging into inotify. Since I know this should only happen once, I don't need to do a loop. Just watch for it to be deleted that first time, and execute the move command. As long as something doesn't cause the need for me to re-install the current running kernel. Can do the same thing for extramodues, and /usr/src/linux-`uname -r` ...
Now I'm just wondering if that sounds utterly mad to anyone before I actually implement it...
Yes, it sounds mad. Don't update the kernel if you don't want to reboot. Hacking around it by creating untracked files rather than changing your behavior seems insane.
Offline