Profile Details

Toggle Sidebar
Recent updates
  • Stassen
    Stassen replied to a discussion, Crontab is not executing script.

    Nick Howitt wrote:

    Ok so you went for sh and not bash but that is a personal choice. The issue is a known issue with cron/crontab and presumably appears somewhere in its documentation (but is not in "man crontab"). The internet has references like https://stackoverflow.com/questions/2388087/how-to-get-cron-to-call-in-the-correct-paths.

    Anyway, it is working now.


    I found that article also and is helpful. My solution was adding the full path in the script. Only then it was working. Hopefully someone will run into this solution in the future when running into the same.

  • Stassen
    Stassen replied to a discussion, Crontab is not executing script.

    I have success with the following mod to the script when used in crontab.

    #!/bin/sh

    PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

    /usr/local/bin/streamripper http://x.x.x.x:8000 -d "/var/flexshare/shares/vol4/1. Streamrecordings/" -o larger -t --quiet -u "FreeAmp/2.x


    Just learned something again. Would be nice if there was a better way of tracing these issues, but I'm happy that I got result. @Nick: Thanks for supporting me during this process ;-)

  • Stassen
    Stassen replied to a discussion, Crontab is not executing script.

    Nick Howitt wrote:

    Confused! I expected you to update your crontab job. I've no idea what you've updated or what it will do.


    In case you wanted to update my cron by
    export PATH=/sbin:/bin:/usr/sbin:/usr/bin, I've tried that, but it returned an error on the word 'export' and that is the reason why it is not in my cronjob.

    Maybe that explains it better ;-)

  • Stassen
    Stassen replied to a discussion, Crontab is not executing script.

    Nick Howitt wrote:

    Hmm. I wonder of your sub-commands are not inheriting the PATH. Can you try changing the path line to:
    I am more used to setting the shell with a shebang:

    For DDNS, ddclient will run as a service. No need for cron.


    Updated cron and path. New results:

    export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/install/script
    echo $PATH
    /sbin:/bin:/usr/sbin:/usr/bin:/install/script

    Crontab

    SHELL=/bin/sh
    PATH=/sbin:/bin:/usr/sbin:/usr/bin:/install/script
    MAILTO=root

    */45 * * * * /install/script/duckdnsorg.sh
    */30 * * * * /install/script/dyndns.sh
    0 16 * * 5 root /install/script/recordingstart.sh
    0 19 * * 5 root /install/script/recordingstop.sh
    0 12 * * 1 root /install/script/recordingstart.sh
    10 12 * * 1 root /install/script/recordingstop.sh

    ps aux | grep 'streamripper'
    root 7724 0.0 0.0 112812 980 pts/0 S+ 12:01 0:00 grep --color=auto streamripper

    Cron.log

    Oct 25 12:00:01 stassen CROND[7430]: (root) CMD (root /install/script/recordingstart.sh)


    Are there additional options to create more details why this is not running or where it stores the content grabbed ?

  • Stassen
    Stassen replied to a discussion, Crontab is not executing script.

    Nick Howitt wrote:

    Crontab does not inherit the root PATH so any executable called from crontab needs to either be called using its full path (including paths within sub-scripts) or you need to set the path at the beginning of your crontab file before any executables are called. Have a look at /etc/cron.d/0hourly as an example.

    Can I ask what is the /install/script/dyndns.sh doing? Did you know you get a free DDNS name with your ClearOS installation? Also ddclient is a good live DDNS updater if you don't want to use your poweredbyclear.com DDNS name.

    Lastly, if you don't want to run from crontab, you can also run your cron jobs from /etc/cron.d just by dropping a file in there.


    In my opinion I'm calling the scripts including a full path. Currently testing an adapted cron including the parameters:
    SHELL=/bin/bash
    PATH=/sbin:/bin:/usr/sbin:/usr/bin
    MAILTO=root

    So my updated crontab looks now like this

    SHELL=/bin/bash
    PATH=/sbin:/bin:/usr/sbin:/usr/bin:/install/script
    MAILTO=root

    */45 * * * * /install/script/duckdnsorg.sh
    */30 * * * * /install/script/dyndns.sh
    0 16 * * 5 root /install/script/recordingstart.sh
    0 19 * * 5 root /install/script/recordingstop.sh
    43 9 * * 1 root /install/script/recordingstart.sh
    59 9 * * 1 root /install/script/recordingstop.sh

    And the permissions in /install/script

    ls -l record*
    -rwxrwxrwx 1 root root 193 Oct 24 20:18 recordingstart.sh
    -rwxrwxrwx 1 root root 86 Oct 17 14:43 recordingstop.sh

    Result -> still not taken into account by cron.

    cron.log

    Oct 25 09:43:01 stassen CROND[28141]: (root) CMD (root /install/script/recordingstart.sh )
    Oct 25 09:45:01 stassen CROND[28275]: (root) CMD (LANG=en_US /usr/clearos/apps/base/deploy/servicewatch >/dev/null 2>&1)
    Oct 25 09:45:01 stassen CROND[28276]: (root) CMD (/install/script/duckdnsorg.sh)
    Oct 25 09:45:01 stassen CROND[28277]: (root) CMD (/usr/sbin/events-notification -i > /dev/null 2>&1)
    Oct 25 09:50:01 stassen CROND[28690]: (root) CMD (/usr/lib64/sa/sa1 1 1)
    Oct 25 09:50:01 stassen CROND[28691]: (root) CMD (/usr/sbin/events-notification -i > /dev/null 2>&1)
    Oct 25 09:50:01 stassen CROND[28692]: (root) CMD (LANG=en_US /usr/clearos/apps/base/deploy/servicewatch >/dev/null 2>&1)
    Oct 25 09:55:01 stassen CROND[29087]: (root) CMD (/usr/sbin/events-notification -i > /dev/null 2>&1)
    Oct 25 09:55:01 stassen CROND[29088]: (root) CMD (LANG=en_US /usr/clearos/apps/base/deploy/servicewatch >/dev/null 2>&1)
    Oct 25 09:59:01 stassen CROND[29429]: (root) CMD (root /install/script/recordingstop.sh)




    To answer your question about dyndns.sh ;-) I'm aware of the DDNS provided by ClearOS but decided to use another provider which can be updated on multiple machines (not only this server) to secure the updates.

    I do want to run it from crontab because it is easy to maintain via crontab -e compared to /etc/cron.d.



    But I'm very happy to get support and to learn from you (and others) via this forum!

  • Stassen
    Stassen started a new discussion, Crontab is not executing script.

    Crontab is not executing script.

    I have something struggle with crontab which I can't resolve. I'm trying to schedule a radio program recording on a weekly basis.
    If the script is executed manually by me (root privilege), everything works as expected. If I schedule it in crontab it does not work. Nothing in /var/log/cron, no PID, nothing.


    #!/bin/bash
    # Record stream and save it
    # recordingstart.sh

    streamripper http://x.x.x.x:8000 -d "/var/flexshare/shares/vol4/1. Streamrecordings/" -o larger -t --quiet -u "FreeAmp/2.x" &

    # End script

    Crontab -l

    */30 * * * * /install/script/dyndns.sh
    0 16 * * 5 /install/script/recordingstart.sh
    0 19 * * 5 /install/script/recordingstop.sh


    Other parts of the Crontab are being executed...

  • Stassen
    Stassen's reply was accepted as an answer

    Re: Can't upgrade Virtualbox via yum update

    First some more details about my setup. I'm running VirtualBox headless combined with phpvirtualbox.
    phpVirtualbox is maintained but don't expect the latest working version the day Oracle releases a new version of virtualbox.
    Phpvirtualbox needs Vboxwebsrv which is available in 6.1.24 and will be again in 6.1.28.

    If you execute yum install virtualbox-6.1, it will install the latest version 6.1.26 without vboxwebsrv, so you can't use phpvirtualbox.

    In short I resolved my upgrade issue by:
    - yum remove virtualbox
    - wget https://download.virtualbox.org/virtualbox/rpm/rhel/7/x86_64/VirtualBox-6.1-6.1.24_145767_el7-1.x86_64.rpm
    - yum install VirtualBox-6.1-6.1.24_145767_el7-1.x86_64.rpm
    - LatestVirtualBoxVersion=$(wget -qO - https://download.virtualbox.org/virtualbox/LATEST-STABLE.TXT) && wget "https://download.virtualbox.org/virtualbox/6.1.24/Oracle_VM_VirtualBox_Extension_Pack-6.1.24.vbox-extpack";
    - VBoxManage extpack install --replace Oracle_VM_VirtualBox_Extension_Pack-6.1.24.vbox-extpack
    - reboot
    - downloaded https://github.com/phpvirtualbox/phpvirtualbox/archive/develop.zip and updated my files used for phpvirtualbox to get rid of all messages

    But it works (again) and it is upgraded (not to the latest version ;-) )

  • First some more details about my setup. I'm running VirtualBox headless combined with phpvirtualbox.
    phpVirtualbox is maintained but don't expect the latest working version the day Oracle releases a new version of virtualbox.
    Phpvirtualbox needs Vboxwebsrv which is available in 6.1.24 and will be again in 6.1.28.

    If you execute yum install virtualbox-6.1, it will install the latest version 6.1.26 without vboxwebsrv, so you can't use phpvirtualbox.

    In short I resolved my upgrade issue by:
    - yum remove virtualbox
    - wget https://download.virtualbox.org/virtualbox/rpm/rhel/7/x86_64/VirtualBox-6.1-6.1.24_145767_el7-1.x86_64.rpm
    - yum install VirtualBox-6.1-6.1.24_145767_el7-1.x86_64.rpm
    - LatestVirtualBoxVersion=$(wget -qO - https://download.virtualbox.org/virtualbox/LATEST-STABLE.TXT) && wget "https://download.virtualbox.org/virtualbox/6.1.24/Oracle_VM_VirtualBox_Extension_Pack-6.1.24.vbox-extpack";
    - VBoxManage extpack install --replace Oracle_VM_VirtualBox_Extension_Pack-6.1.24.vbox-extpack
    - reboot
    - downloaded https://github.com/phpvirtualbox/phpvirtualbox/archive/develop.zip and updated my files used for phpvirtualbox to get rid of all messages

    But it works (again) and it is upgraded (not to the latest version ;-) )

  • Richard George wrote:

    All I can tell you is that, having installed all the dependencies from the COS repositories, mine works without any problems.


    Good to know that everything will work as designed at a certain moment ;-)

  • @Richard: I had a similar idea to install 6.1 manually, but I ran into all kind of dependencies issues. That is where I stopped, due to production risks.