Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Neither of those commands are scripts, and I've no idea what you're trying to do.
The first command (cd /home/user/fp...line), isn't going to do ANYTHING except change a directory, unless the "der" statement is a script somewhere on your path. The second part of it will run index.php...but can't figure out why you'd do that.
The second command (curl...), may need double-quotes around it, but again, I can't see what you're trying to accomplish with this, either, and based on how you've got it structured, it's going to run constantly. Also, it's not going to put output of that command into your home directory, but (since I'm assuming you're doing this through root cron), but have you checked the cron logs and/or the root home directory for the output?
If it was me, I'd re-write the first line, and have one script file that does the cd, run the der command, then run index.php. And the second I'd have a script run at system-startup time, which simply sleeps for 60 seconds, and loops back through and runs again...cron is overkill for an every-minute task.
TB0ne thanks for the answer, if I put double does the command line look like this curl -s "http://www.domain.ph/script.php?type=close" or "curl -s http://www.domain.ph/script.php?type=close"
The first code is just a test cron job to check cron job is working in my server, the script will record the time every time the cron job is process and found out working.
But the second code for what ever reason it does not return the result. I don't if the there is a problem with the curl or on my server.
TB0ne thanks for the answer, if I put double does the command line look like this curl -s "http://www.domain.ph/script.php?type=close" or "curl -s http://www.domain.ph/script.php?type=close"
The first because it runs curl; the second tries to run a command which is the entire string.
To repeat what TBOne wrote and you did not respond to: is this a root cron job? Have you checked the cron logs and/or the root home directory for the output?
Have you checked the cron logs, the home directory of the user cron is running this for and the mail of both root and the user cron is running this for?
My suggestion was not so much intended to get the cron job working as to capture any stdout and stderr output from it. Was file /tmp/some-name-nothing-else-would-use (or whatever you called it) created? Did it have anything in it?
You will have to get better at answering questions if we are to solve this quickly.
the same with
cd /home/folder/public_html/; /usr/bin/php daemons.php?type=extend
My purpose with this cron job is to run this script every minute...
Again, I'll say that you should put this command into it's OWN SCRIPT FILE, and call IT through cron. You can direct the output easier, and debug it easier that way.
curl is probably not in the PATH in the cron env; always use complete paths for cmds & files if calling direct from cron, else (as recommend) create a script, call it in cron and inside the script set any vars reqd.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.