You are not logged in.

#1 2019-03-20 01:11:38

szuruburu
Member
Registered: 2019-03-20
Posts: 2

[SOLVED] Cannot get cron to execute sh script

Hello guys,

I give up. Tried everything I found on the Internet and simply cannot get my shell script to be executed by cron.

Cronie is running

● cronie.service - Periodic Command Scheduler
   Loaded: loaded (/usr/lib/systemd/system/cronie.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2019-03-20 01:00:56 CET; 1h 4min ago
 Main PID: 399 (crond)
    Tasks: 1 (limit: 4915)
   Memory: 10.0M
   CGroup: /system.slice/cronie.service
           └─399 /usr/bin/crond -n

Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.

This is the script. It is executable outside the cron.

#!/bin/bash
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

ssroot="$(date +%F_%H-%M-%S)"
import -window root -quiet -silent /home/szuruburu/pix/ssmakefiles/$ssroot.jpg

And this is my crontag -e file:

SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

* * * * * /bin/bash /home/szuruburu/scripts/ssmake.sh
* * * * * echo Run this command every minute >> /home/szuruburu/crontab.log
* * * * * env > /tmp/env.output

The last two entries are running fine. The output of /tmp/env.output is:

SHELL=/bin/bash
PWD=/home/szuruburu
LOGNAME=szuruburu
HOME=/home/szuruburu
LANG=C
USER=szuruburu
SHLVL=1
PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
_=/usr/bin/env

Any ideas? Thanks a bunch in advance.

Last edited by szuruburu (2019-03-20 01:52:53)

Offline

#2 2019-03-20 01:29:44

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED] Cannot get cron to execute sh script


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2019-03-20 01:47:47

szuruburu
Member
Registered: 2019-03-20
Posts: 2

Re: [SOLVED] Cannot get cron to execute sh script

Ok, thanks a lot. I have managed to get it working with xuserrun

* * * * * /usr/bin/xuserrun /home/szuruburu/scripts/ssmake.sh

Offline

Board footer

Powered by FluxBB