Tiny Core Linux

Tiny Core Base => CorePlus => Topic started by: Boss 429 on April 28, 2017, 07:32:15 AM

Title: Set Shutdown Time
Post by: Boss 429 on April 28, 2017, 07:32:15 AM
Hi,

I've been searching the forums and I'm not really seeing a way to shut down TC at a specific time. I would like to be able to shut the machines down at night without having to interact with them. The closest thing I've found was setting up a delay timer, but that won't quite work for my application.

Thank you
Title: Re: Set Shutdown Time
Post by: netnomad on April 28, 2017, 07:54:55 AM
hi,

you are looking for a tool like cron.
with cron-jobs you can define timetables for commands f.e. shutdown at a specific time.

keep on hacking :-)
Title: Re: Set Shutdown Time
Post by: Misalf on April 28, 2017, 08:38:35 AM
You can use the  cron  bot code to start cron at boot.
The command  crontab -e  is used to create a cron job. An editor will open where you can write in something like this:
Code: [Select]
00 00 * * * /usr/bin/filetool.sh -b ; /usr/bin/sudo /sbin/poweroff
This would, at midnight, perform a backup and shutdown the system.

Then add  var/spool/cron/crontabs  to your backup.
Title: Re: Set Shutdown Time
Post by: Boss 429 on May 01, 2017, 12:36:24 PM
Misalf, When I tried to insert the code into crontab, it wouldn't allow me to run a backup, and the next line of text started to jump across the screen every time I hit the return key to go to the next line. I'm not really sure what would be causing that, but it's consistently doing it
Title: Re: Set Shutdown Time
Post by: gerald_clark on May 01, 2017, 02:01:06 PM
Do not use leading "/" in .filetool.lst.
Title: Re: Set Shutdown Time
Post by: Misalf on May 01, 2017, 05:56:02 PM
Works here.
Are you familiar with the  vi  editor? It can be quite confusing to use. Maybe that's what happened?
Title: Re: Set Shutdown Time
Post by: Boss 429 on May 02, 2017, 12:25:30 PM
I'm fairly familiar with vi editor. I'm just not sure if I'm saving it with the wrong extension? maybe the wrong location? I have entered the code as you have it in your previous post. I get a notification on boot that Crond is running as well.
Title: Re: Set Shutdown Time
Post by: Misalf on May 02, 2017, 12:38:58 PM
I'm just not sure if I'm saving it with the wrong extension? maybe the wrong location?
With  crontab -e , an editor opens with a temporary file name which must not be changed nor must the location be specified; cron takes care about that.
Title: Re: Set Shutdown Time
Post by: patrikg on May 02, 2017, 01:10:11 PM
In lots of Linux dists. You can set the EDITOR environment variable.
So
Code: (bash) [Select]
crontab -e
can use that, instead of the default vi.

Code: (bash) [Select]
export EDITOR=nano
Title: Re: Set Shutdown Time
Post by: Boss 429 on May 03, 2017, 07:49:24 AM
I'm sorry for the poor quality, my camera wouldn't focus and I'm not sure how to take screenshots in TC.. but every time I run crontab -e, this is what happens when I close the command. I'm not sure why it's doing this. I even tried a fresh install of TC just to make sure that it wasn't something that I might have caused.
Title: Re: Set Shutdown Time
Post by: Rich on May 03, 2017, 08:10:55 AM
Hi Boss 429
It appears to be executing a  find  command upon returning to the command prompt for some reason. Also the carriage
returns are behaving like just linefeeds.

Title: Re: Set Shutdown Time
Post by: Boss 429 on May 03, 2017, 08:29:35 AM
I ran the find command to show what it was doing, and when I try to run the backup command, it won't let me. it will more or less "lock up" and not let me do anything unless I reboot
Title: Re: Set Shutdown Time
Post by: Rich on May 03, 2017, 10:18:51 AM
Hi Boss 429
I see, so if you were to just hit enter a bunch of times the prompt would keep shifting down 1 line and to the right by
the width of the prompt. I've seen that behavior when a program launched from a terminal crashes or misbehaves. I
close the terminal and open a new one in that case.
Title: Re: Set Shutdown Time
Post by: Boss 429 on May 03, 2017, 10:52:49 AM
That's exactly what it's doing. Would I just need to run the "exit" command and log back to in to piCore to do so? I'm not using a GUI interface
Title: Re: Set Shutdown Time
Post by: Rich on May 03, 2017, 11:38:15 AM
Hi Boss 429
That's certainly worth giving a try.
Title: Re: Set Shutdown Time
Post by: rdebath on May 05, 2017, 08:02:02 PM
The issue in the image is normally called the "staircase effect" it can be fixed with
Code: [Select]
stty onlcr but it's easier to remember
Code: [Select]
stty sane
I would guess you actual problem is the broken (for the command line) ondemand script in the current version.