cron job working directory

Discussion in 'Installation/Configuration' started by Devin McManus, Nov 18, 2023.

  1. Devin McManus

    Devin McManus New Member HowtoForge Supporter

    Code:
    root@new:~# lsb_release -a
    No LSB modules are available.
    Distributor ID: Debian
    Description:    Debian GNU/Linux 10 (buster)
    Release:        10
    Codename:       buster
    root@new:~# php -v
    PHP 7.3.31-1~deb10u5 (cli) (built: Sep  4 2023 21:49:25) ( NTS )
    Copyright (c) 1997-2018 The PHP Group
    Zend Engine v3.3.31, Copyright (c) 1998-2018 Zend Technologies
        with Zend OPcache v7.3.31-1~deb10u5, Copyright (c) 1999-2018, by Zend Technologies
    Hi there,
    I have two cron jobs that run the same bash script. One of them (web114) runs from a writable directory (/var/www/clients/client2/web114/home/web114), and the other doesn't (/var/www/clients/client21/web84). Before I modify the script to simply change directories, I wanted to check and see if I've just missed a step in configuration. Any ideas?

    Code:
    root@new:/etc/cron.d# cat ispc_web114
    MAILTO=''
    SHELL='/bin/sh'
    
    50      5       18      *       *       web114  /usr/local/myscript/myscript.sh https://example.com /var/www/clients/client2/web114/web c2database >>/var/www/clients/client2/web114/private/cron.log 2>>/var/www/clients/client2/web114/private/cron_error.log #example.com
    root@new:/etc/cron.d# cat ispc_web84
    MAILTO=''
    SHELL='/bin/sh'
    
    5       6       18      *       *       web84   /usr/local/myscript/myscript.sh https://example2.com /var/www/clients/client21/web84/web c21database >>/var/www/clients/client21/web84/private/cron.log 2>>/var/www/clients/client21/web84/private/cron_error.log #example2.com
     

Share This Page