Skip to main content

Does cpanel service manager interfere with cron jobs?

Comments

16 comments

  • ffeingol
    I believe the answer will be dependent on how log it's down. Are you just restarting MySQL or leaving it down for an extended period of time?
    0
  • jeffschips
    It would need to be down for no more than an 90 minutes in the a.m. like 2 -3-ish a.m.
    0
  • cPRex Jurassic Moderator
    Hey there! It sure will - we'll detect the service as down during our checks and try to restart it. Is this related to the server load issues from the other post? You could use the API to disable service monitoring during that time as part of a larger bash script using this tool: Enable or disable a service and its monitoring
    0
  • jeffschips
    yes it is related to the server load issues from the other post. yes I see that i can enable/disable in the whm gui interface for services. I don't want to globally turn off monitor/restart in the gui and I'm guessing I will need to use a script or activate a script in a cron job. Based on what you sent me to can you confirm that my option would be run this command in a cron job as such:
    0
  • cPRex Jurassic Moderator
    The example on that page isn't great, is it? You'll want this:
    0
  • jeffschips
    yeah I thought so, too. Thanks cPRex much appreciate the clarity. Speaking of clarity, why does this forum always ask for my tracking preferences when logging in? This seems like a new thing but since my computer automatically deletes cookies on a regular basis, why can't it remember my preferences by my email address as most other posting services do that so we don't always have to unclick our preferences to enter the forum. I know this is message is not for this particular forum so advise where should I request this. . . thanks again.
    0
  • cPRex Jurassic Moderator
    I'm not sure, but we're moving away from Xenforo soon so it's not something we're going to make the effort to track down. I also seem to have to choose my cookie options more than I would expect.
    0
  • jeffschips
    Thanks. SOLVED!
    0
  • jeffschips
    Actually, what is the "cpsess##########" in the string:
    0
  • cPRex Jurassic Moderator
    The session value changes each time you log in to cPanel, but it will be in the URL.
    0
  • jeffschips
    I must be missing something here - if the cron job is to enter for example,
    0
  • cPRex Jurassic Moderator
    No, you wouldn't be able to use a cron job like that. For a cron, it would be best to use the Bash/command line API instead of the URL version, which uses the WHMAPI1 command line option: whmapi1 configureservice service='mysql' enabled=1
    0
  • jeffschips
    no joy with: 45 21 * * * whmapi1 configureservice service='mysql' enabled=0
    0
  • ffeingol
    I'm not an expert on this particular API call, but I'd think you would want monitored=0, not enabled.
    0
  • jeffschips
    SOLVED: You need to provide the full path to the whmapi1 this worked 23 22 * * * /usr/local/cpanel/bin/whmapi1 configureservice service='mysql' enabled=0
    0
  • cPRex Jurassic Moderator
    I've found that in crons it's usually best to provide the full path as they don't have BASH's built-in $PATH variable to know where to look for executables.
    0

Please sign in to leave a comment.