I would like to run the simple shell command
echo 1 > /proc/sys/kernel/sysrq at each boot, to enable the sysrq keys. When in boot should this be done, and where should I put a script to do it?
Depends on distros.
If you are on Debian-derived distros, there are at least two proper places, /etc/rc.local and crontab. You may invoke crontab as root,
and then insert this line
Alternatively, you may place a line like this
in /etc/rc.local, and this will be executed last. In any case, pls do remember you are using root environment, not yours. Also for this reason, it is best to use absolute paths.
If you are on a systemd distro (Arch Linux, Fedora 19,...) the first option (crontab) is still valid, while the second one (/etc/rc.local) does not exist any longer. In this case, you should learn how to start a service to be run by
If your system is running a version of
This is one of 8 special strings that it supports.
This is far from being the only way to run something at boot time, but it's an alternative.
This question shows a lack of even basic research. Pretty much all variants of Linux (going back a long, long time) have a file /etc/rc.local which runs on startup - you can just add the command to it.
That said, you don't even need to do that. The "correct" way would be to modify / add the line kernel.sysrq = 1 into /etc/sysctl.conf