Linux script wrapper



# You can always choose another directory, just make sure you enter the correct path in the examples
cd /opt/coscale/

# Download the latest version from Github

# Allow users to access the file
chmod +rwxrwxrwx /opt/coscale/

How to use

In this example we will use a script that pings our server 5 times.

  1. Create a script for your job and add the commands you want to run

    touch /home/testuser/

    echo "ping -n 5" > /home/testuser/

    chmod +x /home/testuser/

  2. Add to command to your crontab (crontab -e) and put the CoScale cron wrapper in front of it. Don’t forget to replace [[category]] and [[message]] with your own.

    */5 * * * * /opt/coscale/ --category "[[category]]" --message "[[message]]" --live -- /home/testuser/

Your crontab might look something like this:

# Edit this file to introduce tasks to be run by cron.
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
# For more information see the manual pages of crontab(5) and cron(8)
# m h  dom mon dow   command

*/5 * * * * /opt/coscale/ --category "Monitoring website" --message "ping" --live -- /home/testuser/

# Other examples
*/5 * * * * /opt/coscale/ --category "Monitoring" --message "Ping production" --live -- ping -c 5  
*/5 * * * * /opt/coscale/ --category "Monitoring" --message "Ping production" --live -- /root/
*/5 * * * * /root/

*/5 * * * * /opt/coscale/ --category "Monitoring" --message "Ping production" --live -- ping -c 5  
*/5 * * * * /opt/coscale/ --category "Monitoring" --message "Ping production" --live -- /home/testuser/
*/5 * * * * /home/testuser/


argument explanation
--cli CoScale CLI tool directory
--message Event message
--category Category of the event
--live Live switch, only use when you want to run command and send events, disable for testing
-- Everything after this argument will be read as the command you want to execute. Make sure you escape “ and ‘.


  • Make sure to escape ‘ and “ characters as they may cause problems.
  • The command is always executed, even when CoScale services are having difficulties.
  • Exit code from the script is the same as your command


Ping a production server 5 times

/opt/coscale/ --category "Monitoring" --message "Ping production" --live -- ping -c 5

Clean cache directory

/opt/coscale/ --category "System cron" --message "Cache clean-up" --live -- rm -rf /tmp/cache/website/*