How to run everyday a script

Share your awesome tips and tricks here.

Moderator: Lillian.W@AST

Post Reply
palacz82
Posts: 10
youtube meble na wymiar Warszawa
Joined: Wed Apr 27, 2016 3:14 pm

How to run everyday a script

Post by palacz82 »

Help me!!

I want to execute script like
find /var/log/backups1/ -mtime +30 -exec rm {} \;
find /var/log/backups2/ -mtime +30 -exec rm {} \;
find /var/log/backups3/ -mtime +30 -exec rm {} \;
everyday

how to??
User avatar
orion
Posts: 3485
Joined: Wed May 29, 2013 11:09 am

Re: How to run everyday a script

Post by orion »

You can create a cron job to do that (by crontab command).
palacz82
Posts: 10
Joined: Wed Apr 27, 2016 3:14 pm

Re: How to run everyday a script

Post by palacz82 »

Asustor has somethink like task scheduler or maybe some apps exists?
User avatar
orion
Posts: 3485
Joined: Wed May 29, 2013 11:09 am

Re: How to run everyday a script

Post by orion »

No, I cannot find ADM UI to create user scripts / tasks. I can only create cron jobs through ssh session.
palacz82
Posts: 10
Joined: Wed Apr 27, 2016 3:14 pm

Re: How to run everyday a script

Post by palacz82 »

If I use crontab -e, crontab -i I get: " must be suid to work properly" what shoud I do?
User avatar
orion
Posts: 3485
Joined: Wed May 29, 2013 11:09 am

Re: How to run everyday a script

Post by orion »

palacz82 wrote:If I use crontab -e, crontab -i I get: " must be suid to work properly" what shoud I do?
I guess you might login to NAS through ssh with admin account. You should login as root (the password is the same as admin).
palacz82
Posts: 10
Joined: Wed Apr 27, 2016 3:14 pm

Re: How to run everyday a script

Post by palacz82 »

If I login as root a have permission to crontab, but i still don't know how add a job. if i type crontab -e i see 4 jobs but i cannot add anything
User avatar
orion
Posts: 3485
Joined: Wed May 29, 2013 11:09 am

Re: How to run everyday a script

Post by orion »

palacz82 wrote:If I login as root a have permission to crontab, but i still don't know how add a job. if i type crontab -e i see 4 jobs but i cannot add anything
Oops, sound that you don't know how to use "vi" to edit a file.

If you are using Windows OS, I think you can install WinSCP (free software). You can get any NAS file to your Windows PC, then edit the file.

You'll need to setup a SFTP session to NAS (with root account) within WinSCP. And you need to enable SFTP service under NAS ADM web -> Services -> Terminal. Then, you can get NAS file: /volume0/usr/builtin/etc/crontabs/root.
You can edit this file in your PC, then put it back to NAS.

I suppose you know how to manipulate crontab format. You'd better to create your own script (contents with your "find" commands) and specify it in the "root" file. You can refresh cron jobs with "crontab /volume0/usr/builtin/etc/crontabs/root".
palacz82
Posts: 10
Joined: Wed Apr 27, 2016 3:14 pm

Re: How to run everyday a script

Post by palacz82 »

thanks a lot, your describtion helps me
Post Reply

Return to “Tips & Tricks”