spinner0205 Posted February 26, 2011 Share Posted February 26, 2011 I get the following error with a cron job I have set up: /bin/sh: -c: line 0: syntax error near unexpected token `(' The cron job is: DELETE\ FROM\ thatsact_sadadmins.sm_admins\ WHERE\ DonationDate\ <\ DATE_SUB(NOW(), INTERVAL 1 MONTH) Any thoughts on what I need to fix? Quote Link to comment https://forums.phpfreaks.com/topic/228867-syntax-error-near-unexpected-token/ Share on other sites More sharing options...
trq Posted February 26, 2011 Share Posted February 26, 2011 Cron jobs are executed by your systems shell, therefore your Cron makes NO SENSE at all. Quote Link to comment https://forums.phpfreaks.com/topic/228867-syntax-error-near-unexpected-token/#findComment-1179839 Share on other sites More sharing options...
spinner0205 Posted February 26, 2011 Author Share Posted February 26, 2011 Sorry for some stupid reason I posted the MySQL query. Here is the cron but the error I receive now is ERROR 1102 (42000): Incorrect database name. Is there a specific way to type the database name? /usr/bin/mysql -u username -ppassword 'DELETE FROM thatsact_sadadmins.sm_admins WHERE DonationDate < DATE_SUB(NOW(), INTERVAL 1 MONTH)' Quote Link to comment https://forums.phpfreaks.com/topic/228867-syntax-error-near-unexpected-token/#findComment-1179845 Share on other sites More sharing options...
trq Posted February 26, 2011 Share Posted February 26, 2011 Ah, that makes more sense. /usr/bin/mysql -u username -ppassword -e 'DELETE FROM thatsact_sadadmins.sm_admins WHERE DonationDate < DATE_SUB(NOW(), INTERVAL 1 MONTH)' databasename Note the query is being passed to the -e option and now your database name goers on the end. Quote Link to comment https://forums.phpfreaks.com/topic/228867-syntax-error-near-unexpected-token/#findComment-1179856 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.