You are not logged in.
Pages: 1
I have simple "regroup.service" for systemd, it excue on start "script.sh". Systemd excue "regroup.service" on start but command in script requires root permission.
-rwxr--r-- 1 root root 316 05-31 21:24 /usr/lib/systemd/scripts/script.shWhich way is the best for excue script via systemd?
Last edited by sobota (2013-05-31 20:19:11)
Offline
Does it not work? I'm assuming many scripts/commands at startup require root privileges. Could you explain what the problem is and what the script does?
CLI Paste | How To Ask Questions
Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L
Offline
Script do:
#!/bin/sh
exist=false
start(){
fil=$(ls /dev/nvidia* | wc -l)
if [ $fil != "0" ]
then
exist=true
chgrp video /dev/nvidia*
fi
}
stop(){
if [ $exist ]
then
chgrp root /dev/nvidia*
fi
}
case $1 in
start|stop) "$1" ;;
*) echo "You should pass correct options like start or stop" ;;
esacWhen I call service "#systemctl start regroup" group is changed.
Last edited by sobota (2013-05-31 22:13:37)
Offline
I doubt this is the best way to do it but if that is what happens, what's the problem? Isn't that what the script is supposed to do?
CLI Paste | How To Ask Questions
Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L
Offline
Problem is that after reebot with enable regroup.service group is default. It mean that script does't work.
Last edited by sobota (2013-05-31 22:31:17)
Offline
Have you looked into using a udev rule? I've never used them but it seems like just the sort of thing they are designed for.
EDIT: Also, are you sure you need to do this at all? I thought that most of the point of those groups vanished with the switch to systemd?
Last edited by cfr (2013-05-31 22:47:45)
CLI Paste | How To Ask Questions
Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L
Offline
Pages: 1