![]() ![]() You can shut down your system immediately or at the specified time. When the shutdown is initiated, all logged-in users and processes are notified that the system is going down, and no further logins are allowed. Just in case, I would try without them as I've shown above. The shutdown command brings the system down in a secure way. I never put them there and the examples do not show such. Otherwise, the leading zeroes are probably okay. You can then edit the crontab of the root user with: crontab -e Which I find cleaner than many other solutions. To become root, I use the following: sudo su. The alias allows me to send the emails to multiple administrators instead of just one person. I prefer to use an alias (often defined in /etc/aliases). By default, emails will be sent to root for the root account. One variable which is often updated is the MAILTO=. Keep in mind that the handling of spaces and tabs is different (see the docs for details). If you want to add variables to the shell (or need to in order to run certain commands) you can add or update them at the top of the file. Now you know the full path to that command and you want to use that in your CRON definition: 0 1 * * * /sbin/shutdown -h now So, I would suggest you first run: $ which shutdown In most cases, you want to use full paths for all commands. This includes a minimal PATH and HOME variables. Thanks for everyone help.įor security reasons, CRON uses a very minimal shell environment. It's my first time using Linux so please don't hesitate to explain with as much as details as possible.Įdit: ok, so i found the solution, I just have to set the command one hour before the desired time. I also tried enabling root access by entering the command sudo passwd root then entering su root. I think the problem may be that I don't have root access but sudo -i should give me root access. When I navigate through my files I noticed that I can't access the root folder because I don't have the permission. Ttyname failed inappropriate ioctl for device When i try to login as root, i have the error: I'm using x2go to access Linux, and i cant login directly as root. When I'm about to leave the console, I don't see any errors, I only see that the crontab has been sucessfully installed. I save the crontab with ctrl 0 + enter, then by doing ctrl X. ![]() ![]() I tried a lot of similar commands like 00 01 * * * poweroff, but these commands never work. What I tried is: sudo -i, crontab -e and 00 01 * * * shutdown -h now in the terminal. I want to stop Linux everyday at 01:00 am with cron. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |