• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Cronjobs not working

EdwardVer

New Pleskian
I was trying to do a cronjob on my server to automate website restore of a demo website.

This is the cronjob task i added with SSH command:
---------------------------------------------------------

sh /var/www/vhosts/mydomain.com/subdomains/restorexx.sh

---------------------------------------------------------

This is the actual file being called:

---------------------------------------------------------

mysql -u root –password=pa$$word < /var/www/vhosts/mydomain.com/subdomains/study.restore/study_.sql
rm -Rf /var/www/vhosts/mydomain.com/subdomains/study/*
cp -Rf /var/www/vhosts/mydomain.com/subdomains/study.restore/* /var/www/vhosts/mydomain.com/subdomains/study/
find /var/www/vhosts/mydomain.com/subdomains/study -type f -print | xargs chmod 644
find /var/www/vhosts/mydomain.com/subdomains/study -type d -print | xargs chmod 755

--------------------------------------------------------

I have never done this before so any advice on how to make it to work would be appreciated.

Thanks in advance!
 
Hi,
Thanks for the reply. I was using via shell (crontab -e) and also tried the task manager in parallels.

I tried to run each line via shell and it execute each line without a problem. This should work in cronjob.

mysql -uuser -ppassword databasename </var/www/vhosts/mydomain.com/subdomains/study.restore/study_.sql
rm -Rf /var/www/vhosts/mydomain.com/subdomains/study/*
cp -Rf /var/www/vhosts/mydomain.com/subdomains/study.restore/* /var/www/vhosts/mydomain.com/subdomains/study/
find /var/www/vhosts/mydomain.com/subdomains/study -type f -print | xargs chmod 644
find /var/www/vhosts/mydomain.com/subdomains/study -type d -print | xargs chmod 755

But the owner group is not correct
 
CHMOD command

BTW, Is this the right CHMOD command? It doesn't seem to work

find /var/www/vhosts/mydomain.com/subdomains/study -type f -print | xargs chmod 644
find /var/www/vhosts/mydomain.com/subdomains/study -type d -print | xargs chmod 755
 
Each line works, ok, but does the shell script work?
If not: chmod u+x -> makes it executable

After creating the cronjob, did you get a message like:
"New conjob installed"?

If not, check crontab:
________________________________________________________________
# crontab -e

sh /var/www/vhosts/mydomain.com/subdomains/restorexx.sh

________________________________________________________________

is not enough, you need to set a time, the job's supposed to start,
something like:
________________________________________________________________
# crontab -e

4 * * * * sh /var/www/vhosts/mydomain.com/subdomains/restorexx.sh

________________________________________________________________

have a look at:
[german]
http://troubadix.dn.fh-koeln.de/unix/cronjobs_syntax.html
[english]
http://www.thegeekstuff.com/2009/06/15-practical-crontab-examples/


But the owner group is not correct
Don't know what you mean, sry.


I'm not sure if find works that way, ask google ;)
 
I already have this :

32 * * * * sh /var/www/vhosts/mydomain.com/subdomains/restorexx.sh on

But the owner group is not correct
What i meant by that is when i manually try each command in shell, the owner/group is set to none. If there is no owner group i cannot access the admi area of the website.

...and i am googling now for 2 hours :p
 
The cron job is save and installed. I can see it with crontab -e

49 * * * * /var/www/vhosts/mydomain.com/subdomains/test.sh

The problem is, it does not execute.
 
Last edited:
Solved

I solved my issue with countless hours of trying.

In Plesk Control Panel, I have choosen "Access to the server over SSH : /bin/bash" and used the the "Scheduled Task Manager" to execute the cron job.

30 * * * * /bin/sh /var/www/vhosts/mydomain.com/subdomains/restore.sh

Not it works!
 
Back
Top