Link to home
Start Free TrialLog in
Avatar of RadioGeorge
RadioGeorgeFlag for United States of America

asked on

Cron Jobs: easy to make or farm it out?

I use a couple of cronjobs that reside on my website's "back end" at the hosting company that work like this:

At a set time each week, a batch of files, say from "Folder A." is moved to a folder, replacing the files there which have the same name (overwrites them).

If there are no files in folder A, an email is sent to me notifying me of  the lack of files AND then moves a group of same-named files from a standby folder.

I had these jobs created years ago by a freelancer. Now I need some more. I have a background (from more than ten years ago)  in BASIC and I'm wondering if I can learn how to do this fairly quickly and easily or if it would be better to farm it out to a freelancer. I;m not in a huge hurry, but the sooner, the better.

OR is there an online "auto-writer" type of service that takes your input and generates the code, either at no cost or for a proce?

Your thoughts?
Avatar of Bill Prew
Bill Prew

I would take a look at what the freelancer created and see how understandable they are to you.  they are likely written in one of the unix shells (bourne, c shell, etc) and it will be very different than Basic.  But if they aren't too complex you may be able to puzzle it out enough to feel some confidence doing it yourself.  Also, if the new needs are similar to the old ones, you may be able to copy and adjust some of those existing ones.

If you aren't comfortable then look for an affordable freelancer to do it, doesn't sound like it should be that large a job...

I'm not aware of any tools to automatically write unix shell scripts from descriptive info.  They may exist, I just am not aware...


»bp
Likely easier to do this yourself.

If you farm out the work, you first have to design all the code, then explain it to someone, then give them access to your machine (shudder).

Since most CRON jobs, as Bill suggested, are simple BASH or PERL scripts, likely you can have a knew one written in a few minutes... without giving machine access to some random person.
CRON is just a job scheduler - at specific times it calls a script based on a path.

What the script does is  the real bit that needs work - so you want to make sure that this part is done correctly. Once you have the script setting up the CRON bit is easy.

If you use CPanel or similar setting up a cron job is very straight forward.

If your background is BASIC then you would need to skill up in one of the more common scripting tools that could be used for a CRON job. Which one you use is dependent on your requirements - simple moving of files - you can use pretty much anything. If you need to access databases or do image or media manipulation it might require picking the right tool for the job.

When implementing a CRON job you first test the script out with manual execution on test  data. Get it working the way you want.
Once this is done you fix your paths - because a the cron process executes your script from a folder other than the one it resides in you need to make sure that any resources you are accessing can be found.

Once all that is working you setup your CRON entry and point it to your script.

Ancillary considerations such as logging, email notification and the like can further complicate development which might suggest you use an experienced resource rather than attempt a DIY - on the other hand - we learn by doing and more so from making mistakes so, depending on the mission critical nature of the data / site / files you are working with this might be a great opportunity to learn.
ASKER CERTIFIED SOLUTION
Avatar of Dr. Klahn
Dr. Klahn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RadioGeorge

ASKER

The fabulous example provided by Dr. Klahn and the very descriptive comments by Julian combine to make my decision a lot easier. Thanks to them for taking as much time as they did to make a comprehensive picture.

So what's my course of action?

I'm going to use a freelancer. This id what I've done once before, but it appears the one I used is either unavailable or not interested now. I simply have too much going on right now and do not want to become bogged down with a project that likely will have its fair share of testing and tweaking to finalize.