• 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.

Question Run Scheduled Tasks With Sql Command In Plesk

Mahdi Elahi

New Pleskian
Hi,
I want Insert a record every minute in specified Table, but
how to set sql command for scheduled tasks in plesk ?
i upload a comman.sql in httpsdocs how to use it in scheduled tasks

q88u_11.png
 
You can create simple bash script with command for sql insert inside and use this script in Command * field with full path.
 
To do what?

Create script databaseupdate.sh with content like:

#!/bin/bash
plesk db "INSERT INTO databasename.tablename ....."


make your script executable with

# chmod +x /path/to/databaseupdate.sh

then specify this script with full path (like /path/to/databaseupdate.sh) in Command* filed of screen above.
 
Thanks , i create bash script and upload it on httpdocs , but in what write in Command scheduled task to execute the script file?
how to use it in scheduled task ?

i write in command filed
/zarbafco/bash.sh

but its not run and show this error
'/zarbafco/bash.sh' is not recognized as an internal or external command, operable program or batch file.
at Plesk impersonation(PipeServer::ServerThread::impersonateRunAs line 726)
at Task execution error(runtask::start line 182)
 
Is it really full path to your script - /zarbafco/bash.sh ?
Did you this script executable as I wrote above?
 
/root/bash/bash.sh is correct.
I hope that content of this script is correct too.
You can just run this script in CLI and check that it works as expected and record is added to database correctly.
After that you can run it as Scheduled task.
 
how to use windows cli or plesk cli ?

in windows i use sql server , is different between my sql or sql serve in bash.script

content of script
mysql --user=[zarbafco] --password=[*********] --database=[zarbafco_itisa] --execute="Insert into zarbafco_itisa.dbo.TSync1 (Id,Name,Age) Values (6,'Sara',25)"
 
Last edited:
For Windows case it's better to use direct mysql command with insert for Command * field.
Maybe Windows experts will provide more relevant suggestions.
 
Back
Top