The goal is to force a reboot to another system and this 4 times per year.
So during the months of January, April, July, and October, the operator is asked which system he wants to restart.
If on the 30th of the month, no reboot has been carried out by an operator, the system will reboot automatically to another predefined system.
After a reboot has been done no more question to operator until the next month period.
I have created all the scripts.
The final script uses:
grub2-once --list
grub2-ounce $CHOICE
shutdown -r now
First question:
If I use the Kde user autostart function, how can I lock the operator in the window running the script until it answers yes or no, without being able to leave the window?
Second question:
Is it possible to launch my application in a bash konsole by a systemd “TEST_REBOOT” service before the user’s login is shown; and stay until the “TEST_REBOOT” service ended ( by an answer from the operator ).
This is an interactive application, not driven by timer.
A)
If using kde autostart functionality, how to stick the user in the window script until operator’s anwser has been made.
B)
If using a systemd service (in /etc/systemd/system) , I never be able to show my bash script running in a konsole and then cannot answer to the question
If run under systemd, I suppose that the my main script is started and run by root (-id 0).
If run under kde autostart script before user log in, must find a way run the final command as root without knowing the root password. Must stay in the script window until the operator answer yes/no.
If run under kde autostart script after user log in, must find a way run command as root without knowing the root password. Must stay in the script window until the operator answer yes/no.
Anyways, you cannot do this through the user’s kde autostart. That works after user login. There are 3 stages
the pre plasma desktop
plasma desktop
The system does not know something like “just before user get login screen”. It does not know which user is going to login until the user does.
make systemd-logind.service dependent of service 'reboot is finished'
Set an env var 'reboot is pending' (if in good month) from crontab @reboot ( user later by main script )
Check when X server is running via a systemd service
when X server is running, start bash script 'ask_for_reboot' in a konsole or xterm
if env var 'reboot is pending' is not set then
reset env var 'reboot is pending'
start systemd service 'reboot is finished'
else
ask operator if he wants to reboot to another system
if yes
reboot that clear every things
else
reset env var 'reboot is pending'
start systemd service 'reboot is finished'
fi
fi
systemd-logind.service is activate