EFW Support

Support => General Support => Topic started by: bingel on Tuesday 25 September 2012, 12:58:30 am



Title: EFW 2.5.1 - Unable to edit crontab [solved circumventing the problem]
Post by: bingel on Tuesday 25 September 2012, 12:58:30 am
I would like to edit root crontab in way to automatically shutdown my firewall.
I tried:

Code:
fcrontab -e

but I obtain this error:

Code:
16:54:13 fcrontab : editing root's fcrontab
16:54:13 Error while running "/bin/vi": No such file or directory
16:54:13 could not stat /tmp/fcr-NapHVp: No such file or directory
16:54:13 could not remove /tmp/fcr-NapHVp: No such file or directory

Both vi and nano are correctly installed and running.


Title: Re: EFW 2.5.1 - Unable to edit crontab
Post by: fqureshi on Tuesday 25 September 2012, 06:50:03 am
Consider making your changes to the following files as per your need:

cron.daily/  It runs daily and execute at 1:25 midnnight   
cron.hourly/   it runs every hour ....01  * * * * every hour
cron.monthly/ 
cron.weekly/

Create a file in the directory and give following permissions

chmod 0777 <filename>

It depends under which folder you create the file and it will be run respected to the folder parameters under /etc/cron

Hope this helps


Title: Re: EFW 2.5.1 - Unable to edit crontab
Post by: bingel on Tuesday 25 September 2012, 11:36:03 am
Already tried but, unless I forgot to set permissions or to restart cron, I think it did not work. Now I will try again paying more attention to permission and then I'll make my report.

I used this script:

Code:
#!/bin/sh
shutdown -h 1:30


Title: Re: EFW 2.5.1 - Unable to edit crontab
Post by: fqureshi on Tuesday 25 September 2012, 11:44:48 am
Cheers


Title: Re: EFW 2.5.1 - Unable to edit crontab
Post by: bingel on Tuesday 25 September 2012, 09:52:07 pm
You were right!
I think I forgot to restart "cron" after the various changes and especially after changing the system time to test the functioning of the script.

Thanks again.


Following (as a reminder and to help others) is a summary of what was done:

-logged via ssh (as you probably know)

-generated a script for shutdown (change "1:30" with the time you prefer):

Code:
cat > /etc/cron.daily/autoshutdown [RETURN]
#!/bin/sh [RETURN]
[RETURN]
shutdown -h 1:30 [RETURN]
[CTRL+C]

-set permissions:

Code:
chmod 755 /etc/cron.daily/autoshutdown

-restarted cron:

Code:
./etc/init.d/fcron restart


Title: Re: EFW 2.5.1 - Unable to edit crontab [solved circumventing the problem]
Post by: gege on Saturday 27 June 2015, 07:13:56 pm
This guide also works with eandian 3.0.5 ?
why not get it to restart , you have any advice?


Title: Re: EFW 2.5.1 - Unable to edit crontab [solved circumventing the problem]
Post by: mmiat on Thursday 02 July 2015, 08:28:55 pm
my script is:

Code:
#!/bin/sh
/sbin/shutdown -r now &> /dev/null
exit 0


Title: Re: EFW 2.5.1 - Unable to edit crontab [solved circumventing the problem]
Post by: speccompsol on Friday 03 July 2015, 12:05:24 pm
Use the following and similar for scheduled reboot and/or shutdown  . . . . .

you can add a script in your /etc/anacron.monthly (substitute weekly, daily, etc for monthly) in this way:

nano /etc/anacron.monthly/reboot

Then write the following lines:

#!/bin/sh
reboot
exit 0

Change the permissions with chmod a+x /etc/anacron.monthly/reboot and you are done.