Page 1 of 1

cron job change

PostPosted: Wed May 26, 2010 12:58 pm
by spaquet
I noticed that some jobs are more time and CPU consuming than others.

I focused my attention on record compression and noticed that this job is run every 3 minutes. I think this is not the best way to deal with that and I suggest the following changes:

1. Once a day compression and transfer of compressed files:
Code: Select all
*/4 08-22 * * * /usr/share/astguiclient/AST_CRON_audio_1_move_mix.pl
00  02    * * * /usr/share/astguiclient/AST_CRON_audio_2_compress.pl --MP3

2. In stead of having several processes (one per task at the moment) it could be easier to manage the operation flow by having a single executable file to deal with all operation (ranging from mixing to transfer).

3. It would be great to have a security to insure that the process is not already running. This would prevent 2 or more compression process to run at the same time, situation that can lead to crash the server when they come competing with one an other for the same resources.

PostPosted: Wed May 26, 2010 6:23 pm
by williamconley
there are many versions and opinions on the topic. the issue is availability of the files: if you have the need to listen to a recording a few minutes after it is made (to verify a sale, for instance), then once a day is not entirely suitable.

if you wanted to create an area in the server GUI where preferences such as this would be easily stored, that would help out with the management of the sound manipulation. right now, of course, it is left to the individual to decide how often/what format/when to push to storage server, etc.

PostPosted: Thu May 27, 2010 9:06 am
by spaquet
Totally agree.

I will try to have some kind of lock to prevent 2 or more identical process to be run at the same time.

PostPosted: Thu May 27, 2010 10:01 am
by williamconley
you can just have that particular item begin with a system call to see if it's already running
Code: Select all
ps -A | grep XXXX

works fairly well for this. if it's already running, just don't start another one

PostPosted: Sat Jun 19, 2010 9:29 am
by spaquet
Just great idea.
Faster and more reliable in case of system restart than a lock.