Someone please help me to run the script to maintain a Job: Which can be run for every one hour and should maintain the last two hours files only. It should delete the rest of the files in a dir.
Someone please help me to run the script to maintain a Job: Which can be run for every one hour and should maintain the last two hours files only. It should delete the rest of the files in a dir.
Please suggest me with the sample script.
Thanks !!
Reagrds,
Rama
Hello,
use crontab with find and exec rm
for example (based on your distri) :
For example:
find . -mtime 0 # find files modified between now and 1 day ago
# (i.e., within the past 24 hours)
find . -mtime -1 # find files modified less than 1 day ago
# (i.e., within the past 24 hours, as before)
find . -mtime 1 # find files modified between 24 and 48 hours ago
find . -mtime +1 # find files modified more than 48 hours ago
find . -mmin +5 -mmin -10 # find files modified between
# 6 and 9 minutes ago
If you, yourself, the person for whom this task matters, cannot be bothered to try, why should any of us invest our time? Especially when there is no indication that you have taken any initiative to read the cron-related manual pages, or to search the web for a tutorial, or even to write a single line of code as a first attempt at a solution.
You'll find that most members are more willing to devote their valuable time to those that help themselves. Read some of the documentation, make an attempt to solve the problem, demonstrate this by posting your script and error messages, and we will be happy to help you with specifics.
Regards,
Alister
These 2 Users Gave Thanks to alister For This Post:
Hi,
I have a VPN tunnel. It is going down occasionally. I need to run "/usr/sbin/ping 172.xx.xx.xx.xx" and it give mes output "172.xx.xx.xx is alive" and immediately after that VPN tunnel comes up.
Till we find permanent solution, I want this command to run in background, like every one hour.... (4 Replies)
Hi guys,
I have written a script that waits for a trigger file.
Then checks the time of the trigger.
if the trigger finished between 8pm and midnight then runs a job.
else it waits till 1am then runs a different job.
I am still very new to scripting so any suggestions to improve my... (4 Replies)
Hi I have a shell script I would like to run it has to run twice a day every 5 seconds for an hour I can do this with cron but I was hoping there was an easier way. Is there a way to make a process sleep only at a certain time of day say between 1 and 2 pm? Or under certain conditions?
Any help... (8 Replies)
Hi ! all, I have once script to remove temporary cache and temporary xml files
looks like this, as it is taking more space, I would like to run automatically every 12 hour once, and then I want to receive some log as acknowledgement
#!/bin/sh
echo "Removing logs and temp files (typically... (4 Replies)
Hi,
Can anyone help me in finding how to run a specific job every hour without using crontab.
Say for example i need to run a command ps -aux in the starting of every hour.. (3 Replies)
I have 2 pages writing in php, and i want cron job to run the first page 'every hour' and the second page every '24hours in other words mid night'. am using cPanel
i put this code on a text file
0 * * * * /home/axe/public_html/admin/viewmemstat.php 1>/dev/null 2>&1
and on the 'Command... (5 Replies)
Hi All,
I m not able to run at job with normal user on AIX system
os version is 5300-05-06.
I am able to run at job only with root user.
When I try to run at job with any other user I am getting error:
at: you are not authorized to use at. Sorry.
I checked at.deny file, it is... (4 Replies)
Hi All,
I want to run a script on the hour during a 24 - hour period; easy enough cron will take care of that..however I want the script to only run for only 30mins..
so with the script it knows its 30mins are up so exits.
any ideas?
Any help, greatly appericated.
Thanking you all... (2 Replies)