You wouldn't use cron for this - you can possibly use inetd (depending on your specific distro)
I don't like this solution, but maybe you could do something like add
nc -l 2222 | /bin/bash -e
To /etc/rc.local which would silently wait on port 2222 and then issue a shell. After allowing the appropriate host on a firewall you could then connect to this and silently issue a reboot command (it will not output the result to the terminal). NOTE THAT I HAVE NOT FULLY TESTED THIS.
A simpler way to solve the problem might be to simply install "telnetd" for your distribution and use plain old telnet to connect into your system - thats the way we did it before SSH (... now get off my lawn !)
Another way of solving the problem - using crond would be to set up something like FTPD. Then write a script which runs every minute (or whatever) from cron to check for the existance of that file and reboot if it exists. In that way you could also get some protection by (a) relying on a valid username/password for FTP and the name of the file. Its still not an encrypted session though.
I guess a bash shell would do. I was hoping there was a way to pipe directly to the reboot command but
nc -l 2222 | reboot
reboots the system even when no one has connected. – Sridhar Sarnobat – 2015-11-22T06:03:25.0601You could probably create a script like /bin/bash; read; /sbin/reboot and then nc -l 2222 | /path/to/script - which I expect would wait for the enter key to be pressed before triggering the reboot. If you go with the "telnet" option, you could create a user (with uid=0) and a shell "/sbin/reboot" to reboot as soon as they log in. – davidgo – 2015-11-22T06:10:28.223