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??
How to run everyday a script
Moderator: Lillian.W@AST
-
- Posts: 10
- youtube meble na wymiar Warszawa
- Joined: Wed Apr 27, 2016 3:14 pm
- orion
- Posts: 3485
- Joined: Wed May 29, 2013 11:09 am
Re: How to run everyday a script
You can create a cron job to do that (by crontab command).
-
- Posts: 10
- Joined: Wed Apr 27, 2016 3:14 pm
Re: How to run everyday a script
Asustor has somethink like task scheduler or maybe some apps exists?
- orion
- Posts: 3485
- Joined: Wed May 29, 2013 11:09 am
Re: How to run everyday a script
No, I cannot find ADM UI to create user scripts / tasks. I can only create cron jobs through ssh session.
-
- Posts: 10
- Joined: Wed Apr 27, 2016 3:14 pm
Re: How to run everyday a script
If I use crontab -e, crontab -i I get: " must be suid to work properly" what shoud I do?
- orion
- Posts: 3485
- Joined: Wed May 29, 2013 11:09 am
Re: How to run everyday a script
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 wrote:If I use crontab -e, crontab -i I get: " must be suid to work properly" what shoud I do?
-
- Posts: 10
- Joined: Wed Apr 27, 2016 3:14 pm
Re: How to run everyday a script
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
- orion
- Posts: 3485
- Joined: Wed May 29, 2013 11:09 am
Re: How to run everyday a script
Oops, sound that you don't know how to use "vi" to edit a file.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
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".
-
- Posts: 10
- Joined: Wed Apr 27, 2016 3:14 pm
Re: How to run everyday a script
thanks a lot, your describtion helps me