How to set cron in cakephp in cpanel on linux server - cron

How do i set the cron command in Cpanel in Linux server i use this it works for me is there any proper way
wget http://www.vloghit.com/crons/send_mail

You should use the full path for wget like /usr/bin/wget instead of just plain wget. Depending on the WHM server configuration the crons might be running as jailed so you might get an error stating that wget command was not found if you do not use the full path to the binary. You are also supposed to receive an email notification from that cron job. Are you geting it? I'm asking because in those email notifications you get also an error message that can help you to understand why the cron was not working.

Related

cPanel cron job, no input file specified?

I've just set up my first cron-jon to run a stock script every night.
Running it manually works fine.
It's stored in /admin/stock_update.php
The command i'm running is /usr/bin/php -q /admin/stock_update.php
But I'm getting emails saying no input file is specified?
Any ideas?
Cheers
Network services almost never expose actual paths on the server's hard disk drive and even if they could it isn't a behaviour you can rely on. So the fact that your file is located at /admin/stock_update.php in the FTP server doesn't say much about actual location on disk, which is what local command-line utilities expect.
In PHP, you can find path on disk of current file with the __FILE__ magic constant. You can create a test script:
<?php
var_dump(__FILE__);
... upload it to the same FTP location and execute through the web server. If that's not an option because files in your FTP account in not visible from the web you can run the file from cron and check the email.
Do you have CloudLinux kernel installed on that server and CageFS filestyem? If yes try running this:
cagefsctl -w cpaneluser; cagefsctl -m cpaneluser
Then try running the cron again

How do I restore CronTab to my WebMin system

I don't know if this was an effect of the shellshock attack which my server was victim to (or another attack that worked) but it basically enabled the hacker to overwrite my SSH config file when the server rebooted.
This new file used wget to load in a file from a website, then another library of hack functions which I guessed he then used to run hacks/DOS from my server. I caught it pretty fast and ideally want to upgrade but because I have cancer and just had a big operation it is too much effort at the moment.
Therefore I did a lot of house keeping, changing passwords, removing shell access, reverting back to DASH, replacing the default shell for root and any other users to another folder with symbolic links, restoring the config file for SSH, removing CGI functionality from config files e.g
ScriptAlias /cgi-bin/ /home/searchmysite/cgi-bin/
#
allow from all
#
Removed AW stats and Webalizer for all virtual min sites.
I already had DenyHosts and Fail2Ban installed.
I also blocked in/outbound traffic to the IPs of the sites he was getting the files from.
However it seems since this change I have lost the visual cron manager from webmin.
When I go to the menu item "Scheduled Cron Jobs", it says, "The command crontab for managing user Cron configurations was not found. Maybe Cron is not installed on this system?"
However I can see in the file system it exists.
When I run crontab -l or crontab -e I get "Permission Denied"
whoami shows "root"
I did think at the time of the hack this was all related and he had used SSH and a Cron job to get his hack running.
What I want to know is how I can get the CronTab manager back.
All the cron jobs are still running such as importing feeds into my websites, running scheduled emails and so on, what I don't know is how to resolve this without a full rebuild.
If I had the time and energy I would do that but I am totally drained and before this hack everything was just running smoothly and my websites which bring me in money were working fine.
They currently are still working fine and I regularly check my logs for IPs that look odd, have strong htacess rules for xss/sql/path travesal/file hacks and ban whole countries from Cloudflare which the site sits behind. So I don't "think" the machine is compromised at the moment even if it is old - could be wrong though!
details of box
Operating system Debian Linux 5.0 Virtualmin version 3.98.gpl GPL WebMin Version: 1.610 Kernel and CPU Linux 2.6.32.9-rscloud on x86_64
So if anyone can help me get my crontab manager back that would be great.
Thanks
1) check if chattr exists, if not, download a new one.
2) type whereis crontab, then chattr -isa /path/to/crontab.(usually /usr/bin/cron) then chmod crontab back to it original settings.
3) navigate to /var/spool/ and
chattr -isa cron
cd cron
chattr -isa crontabs
4) remove cron entry in /etc/cron.weekly
Look in /etc/cron.weekly for any new

cron job does not work in cpanel

I have put this command line in Cpanel cronjob
/usr/local/bin/php -q /public_html/myfolder/directory/admin/cron.php
and got this error
Could not open input file: /public_html/myfolder/directory/admin/cron.php
I have checked, the file is there in the folder. This is basically a script that sends a login
reminder to every member of the MySQL database. The script runs successfully if I launch it from the URL in browser.
Use full path:
php -q /home/username/public_html/myfolder/directory/admin/cron.php
Or simply use get the URL :
GET http://example.com/myfolder/directory/admin/cron.php

Jenkins ignores proxy settings while building a job

I set a proxy under Plugins in Jenkins like suggested online.
I also edited the /etc/environment
bash-3.2$ cat /etc/environment
http_proxy=proxy.company.net:8080
https_proxy=proxy.company.net:8080
HTTP_PROXY=proxy.company.net:8080
HTTPS_PROXY=proxy.company.net:8080
HTTPS_PROXY_REQUEST_FULLURI=false
HTTP_PROXY_REQUEST_FULLURI=false
I verfied the variables and they are available on logon.
When I start ant manualy as root via ssh, my "composer.phar" script is able to connect and download files. As soon as Jenkins starts the job (I think its the "jenkins" linux user), he waits until timeout and aborts the build. I used "su jenkins -s /bin/bash" to get a shell as "jenkins" and the env-vars are set correctly...
What can I do? Why does Jenkins ignore these ENV-Vars?
Thanks.
The http_proxy variables (as seen e.g. on the wget man page) require a "http://" prefix to work properly for many programs.
Jenkins on the other hand has a proxy configuration at Manage Jenkins > Plugin Manager > Advanced. This configuration overrides the environment variables.
Check Alex' answer to another question for getting around this behavior for individual nodes/builds.
I did not get it solved. After a restart the server fails all Jenkins Jobs for some minutes... suddenly the connection to the proxy succeeds and everything works well.

File path for a Cron Job

Hi I want to run a cron job to call a PHP script on my server. I am using Cpanel from my web host and these are the options:
Minute:
Hour:
Day:
Month:
Weekday:
Command:
I am really struggling to point the command to my file I am using this line /home/abbeysof/public_html/adi/cron/daily.php but I am getting this error:
/bin/sh: /home/abbeysof/public_html/adi/cron/daily.php: Permission denied
I asked my web host for help and this is the response:
If you use cpanel to create it, it will fill in the path for you. Typically /home/username/public_html/etc
Can anyone please offer some advice?
Advise 1: use wget command, wget runs the PHP script exactly as if it was called from the web so the PHP environment is exactly the same of when calling the file from the web, it's easier to debug your script then.
wget -O - http://yourdomain.com/adi/cron/daily.php >/dev/null 2>&1
The cron jobs has to be created going into cPanel cron jobs menu. I don't understand if you have this clear by reading your hoster's answer.
And advise 2: change web hosting, try this one they don't leave you alone.
Sorry, I don't know anything about cpanel, but it sounds like:
if you created the file daily.php, then you need to change the permissions on it
if they created the file, then there's a bug in their creation routine.
Good luck!
try this one
/usr/bin/php -q /home/yourCpanelUsername/public_html/filename.php
for some cpanels it might be like this
/usr/local/bin/php -q /home/yourCpanelUsername/public_html/filename.php
Sounds like you need to make /home/abbeysof/public_html/adi/cron/daily.php executable.
The link might help you.
https://www.inmotionhosting.com/support/edu/cpanel/how-to-run-a-cron-job
There is difference if you are using VPS than sharing hosting for giving the command.
You may need to use user-agent & cPanel-Cron along with your url.
curl --user-agent cPanel-Cron http://example.com/cron.php

Resources