I'm so confused with the pm2-logrotate configuration, i need some help. I've search for documentation and googled with zero result. I just want to rotate the log every week.
I've tried using pm2 set pm2-logrotate:rotateInverval 0 0 * * 0 but the log file generated daily.
I just don't understand that cron stuff and i need some explaination, can somebody explain it to me?
thank you in advance.
While your cronjob seems fine. But there are some other configurations also associated with pm2-logrotate. Like max_size, the default max size of log is 10 MB, if your log exceeds that then pm2 will rotate it. Say, you want to change it to 10GB, then issue this command pm2 set pm2-logrotate:max_size 10G. You can specify the size as you wish 10K, 10M, 10G. I have faced a similar problem when the log got rotated 3-4 times a day instead of following the specified frequency.
Without being wrapped in quotation marks, it's likely that only the first 0 is being read in your interval. So instead of interpreting the interval as 0 0 * * 0, it is interpreted just as 0.
The following should do the trick:
pm2 set pm2-logrotate:rotateInverval "0 0 * * 0"
As for understanding the cron syntax, try pasting the values in here for an explanation: https://crontab.guru/#0_0___0
Your problem is caused because you spelled rotateInterval wrong.
Related
I'm trying to insert timestamp with milli seconds into a database. I tried following steps but haven't had any luck.
Extend field value to milli seconds , with length 26 and scale 3.
Used StringToTimestamp(timestampInString,"%yyyy-%mm-%dd %hh:%nn:%ss.3"), Resulting null value in output.
Modified the default time Stamp in job properties to %yyyy-%mm-%dd %hh:%nn:%ss.3
Design :
Sequential file --> TX --> destination (SQL/Seq file)
Could you please assist a solution for this?
What you tried looks good so far with one exception:
length 26 and scale 3
Using Db2 for example you would need to specify length 26 precision 6.
26 and 3 do not fit as
%yyyy-%mm-%dd %hh:%nn:%ss has length of 20
Specifying microsenonds is extended attriute is also necessary.
Have a try and provide more details of the target system if you still have problems
try below command in transformer stage and set the target data type as per the requirement, it will give the required result:
StringToTimestamp(Columnname,"%yyyy-%mm-%dd %hh:%nn:%ss.3")
Most important thing is to override the default NLS settings in the job with expected format (%yyyy-%mm-%dd %hh:%nn:%ss.3) which you have already completed.
Now, for the microseconds part which is not being displayed, you can enable the Microseconds extended attribute for the field in the target stage used.
Also you can refer this link from IBM which explains a similar scenario
I have implemented web-audio-api and I am tracking the changes in volume across the file. The volume stops being tracked after 60 minutes. How can I ensure the audio is tracked for the full length of the file (or set the parameter to be something unreachable)?
audioPeak stops after 60 minutes:
It Seems it working perfectly. Please look at db and update
ALTER TABLE tbl_filesforengineprocessing CHANGE COLUMN audio_peak audio_peak LONGTEXT NULL AFTER user_id;
I want to set a cron job to run at 00h15 every Friday. Is this the correct way to do this:
15 0 * * 5
Use this kind of website to validate your crons:
http://crontab.guru/#15_0___5
I'm running this script;
$query = "SELECT * FROM XXX WHERE email='$Email'";
if($count==1) // fails
if($count==0) // succeeds
If successful
mysql_query ("INSERT INTO XXX (email) values ('$Email'");
Then proceeds onto the next script.
So, it checks to see if you have already ran this script in the past on that account, if you have your email is stored then you can't run this script ever again on that same email.
However, after this script has been processed I want it to delete the row created for the email after 6 hours.
So that after 6 hours they may run the script again.. I've been enlightened that I need to use Cron jobs for this, But I'm not sure how.. Any help is highly appreciated!
Many regards, and thanks in advance.
0 0,6,12,18 * * * /path/to/mycommand
This means starting from hour 0, 6, 12, and 18 the cron job would run. That would be the cron needed to do what you want.
Depending on which linux version you are running you will need to see how to actually create the cron job.
I would think at now +6 hours is a better choice here.
I am learning about cronjob and I found this piece of code in one project which fetches record from twitter,
the code goes like this:
#0 * * * * cp /vold/www/Abcd/log/twitter_feed_item_aggregator.log vold/www/Abcd/log/twitter_feed_item_aggregator.log.backup; > /vold/www/Abcd/log/twitter_feed_item_aggregator.log
Can anyone explain what this piece of code does?
Hm... Copies a twitter agregator log each hour, and then clears it.
This part 0 * * * * means 'every 0 minutes'. Minute 0 is when a new hour starts.
This part cp /vold/www/Abcd/log/twitter_feed_item_aggregator.log vold/www/Abcd/log/twitter_feed_item_aggregator.log.backup obviously copies the log to a backup.
This part > /vold/www/Abcd/log/twitter_feed_item_aggregator.log outputs the output of no command to the file, thus clearing it.
The hash at the start of the line comments out the line so it does nothing. Without that it would do as #playcat says.