CRON JOB run script daily at 6PM - automation

so i set up my php page and the cronjob, in order to create an excel file with data in it, everyday at 6PM, but it is not working as intended.
it executes the script every 2 days not daily.
0 11 * * * wget -q --spider http://example.com/UserReport_Export.php
it had actually created the file at 1 june, and 3 june, while 2 june was not there. any idea?
i also put the time 11 in the script cuz of server time, in order to match 6PM in my local time, maybe it affects anything? thank you

You can set the cron like this:
0 18 * * * wget -q --spider http://example.com/UserReport_Export.php
There are also online tools for cron jobs like this which can help out. The cron that you have set seems to be correct, if 11 is matching your local time.
it had actually created the file at 1 june, and 3 june, while 2 june was not there. any idea?
Is it possible for the script or anything else to interfere with your excel file?

Related

Automatically updating data from an API to an SQL database?

I have data coming from an API in JSON format which I then run a few functions/transformations in python and then insert the data in to an SQL database through pandas & SQLalchemy.
Now, how do I automatically do this at the end of every day, without having to open up the script and run it manually?
You can use crontab on a server (or your Linux/Mac laptop but it will not run the script if its turned off of course).
You can run crontab -e to edit the crontab file. Add something like the following to run your script everyday at 11 PM:
0 23 * * * ~/myscript.py
crontab guru is a useful resource to try different schedule expressions.

Autosys job history for last year

I need to find job history for a job for the last 6 months. I have tried autorep-j -r -n but this just gives me data for last nth execution while I want data for all the days. Is there a way to do this through command line?
There is no way with that cmd to get that information.
I would query: $AUTOUSER/archive
Or look in DB if you have access there
Dave

Heroku - Update db column each 1st of the month

In my app I have a Budget model with daily_avg column.
Also there are BudgetIncome and BudgetSpending models.
daily_avg = (BudgetIncome.sum(:debit) - BudgetSpending.sum(:credit))/Time.days_in_month(current_month)
I need to update this column every 1st day of month, cause in every month there're different quantity of days.
So, I'll write the script, but I don't know:
Where to put this script?
How to start it every 1st day of month?
I'm using PostgreSQL and deploying my app on Heroku.
Thanks for any help.
It's the first time I'm working with scripts for DB, so I don't know what information I need to provide you to help me with it.
Heroku has a scheduler you can use:
https://devcenter.heroku.com/articles/scheduler
"Scheduler is an add-on for running jobs on your app at scheduled time intervals, much like cron in a traditional server environment."
Install with: $ heroku addons:add scheduler:standard

Unexpected error, while copy query results to table using google java bigquery api for GAE

I'm trying to copy query result to a new table, but I'm getting an error :
Copy
11:13am
query results to 49077933619:TelcoNG.table
Errors:
Unexpected. Please try again.
Job ID: job_090d08f69c8e4199afeca131b5279393
Start Time: 11:13am, 12 Aug 2013
End Time: 11:13am, 12 Aug 2013
Copy Source: 49077933619:_8dc46c0daeb9142a91aa374aa59d615c3703e024.anon17d88e0e_0960_4510_9740_b753109050f4
Destination Table: 49077933619:TelcoNG.table
I get this error since last Thursday (8 Aug 2013).
This functionality has worked perfect for over an year.
Are there any changes in the API?
It looks like there is a bug in detecting which datacenters a table created as the result of a query has been replicated to. You're doing the copy operation very soon after the query finished, and before the results have finished replicating. As I mentioned, this is a bug and we should fix it very soon.
As a short-term workaround, you can either wait a few minutes between the query and the copy operation, or you can set a destination table on your query, so you don't need to do the copy operation at all.

Schedule a cronjob on ssh with command line

I am using the amazonaws es3 server.I want to schedule my cron with command line.
I am using the this command for scheduling the cron job
at -f shellscript.sh -v 18:30
but it will schedule for only one time i want to configure manually like once a day or every five minutes .
Please help with command which command i have to used
Thnaks,
As #The.Anti.9 noted, this kind of question fits in Serverfault.
To answer your question, crontab is a little more powerful than 'at' and gives you more flexibility as you can run the job repeatedly for instance daily, weekly, monthly.
For instance for your example, if you need to run the script every day at 18:30 you'd do this,
$ crontab -e
then add the following
30 18 * * * /path/to/your/script.sh
save and you are done.
Note: 30 18 indicates time 18:30, and *s indicate that it should run every day of every month) If you need to run it on a particular day of the month just check it out on the man page of crontab.
Doesn't crontab -e work?
and to generate crontab code http://www.openjs.com/scripts/jslibrary/demos/crontab.php should help.
You can use the command crontab -e to edit your cron planned execution. A good explanation on how to set the time can be found on the Ubuntu forum