I have created a script which will parse my already existing file. I want to apply cronjob in it in which I want to give timings that after every minute my script should execute automatically.How can I do it in linux script?
            Asked
            
        
        
            Active
            
        
            Viewed 207 times
        
    2 Answers
2
            
            
        Add the following to your crontab:
* * * * * /path/to/your/script
Use the command crontab -e to edit your crontab.
 
    
    
        Barmar
        
- 741,623
- 53
- 500
- 612
- 
                    Thanks for your reply.I have added it in crontab. SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root HOME=/ # run-parts 01 * * * * root run-parts /etc/cron.hourly 02 4 * * * root run-parts /etc/cron.daily 22 4 * * 0 root run-parts /etc/cron.weekly 42 4 1 * * root run-parts /etc/cron.monthly * * * * * /op/wrd/send_mail.sh #my script path – user3559774 Jun 19 '14 at 07:52
- 
                    is this corrct way?How do i execute my script now? – user3559774 Jun 19 '14 at 07:54
- 
                    1My answer was for your personal crontab, which you update using `crontab -e`, not the system-wide `/etc/crontab` file. – Barmar Jun 19 '14 at 07:56
0
            
            
        You could follow Barmar's answer and have a script running every minute thru a crontab(5) entry.
However, since you want to trigger some action when a file has changed, on Linux specifically, you could also use inotify(7) facilities, and have something run when a particular file has been modified. Then use incron
 
    
    
        Community
        
- 1
- 1
 
    
    
        Basile Starynkevitch
        
- 223,805
- 18
- 296
- 547
