problem with configuration

67 views
Skip to first unread message

Marek Niemczyk

unread,
Sep 29, 2017, 7:54:58 AM9/29/17
to hcron-users
Hi John,

I have hard time getting hcron to work. I'm using Raspbian Wheezy on Raspberry Pi. Installed it via deb package.

My current config:

~/.hcron/raspberrypi/events/test:
as_user=
host=localhost
command=whoami > /home/pi/hcrontest/test.out
notify_email=
notify_message=
when_month=*
when_day=*
when_hour=*
when_minute=*
when_dow=*
template_name=

/etc/hcron/hcron.allow
# user names
pi
root

running 

ssh localhost whoami > /home/pi/hcrontest/test.out

works ok, the file is being created with "pi" (username) inside. So the ssh is configured properly, I guess...

When I'm trying to reload hcron with 

hcron-reload

I can see in log file:

/var/log/hcron/hcron.log:
2017-09-29T13:37:00.489829|work||0|0.000635
2017-09-29T13:37:00.491777|sleep||60
2017-09-29T13:38:00.414464|message||info|scheduling for next interval (2017-09-29 13:38:00)
2017-09-29T13:38:00.417590|message||info|signalHome was modified
2017-09-29T13:38:00.426471|message||warning|Could not install snapshot file for user (pi).
2017-09-29T13:38:00.429144|work||0|0.000571
2017-09-29T13:38:00.431191|sleep||60
2017-09-29T13:38:00.521099|message||info|scheduling for next interval (2017-09-29 13:38:00)
2017-09-29T13:38:00.523935|message||info|signalHome was modified
2017-09-29T13:38:00.527740|work||0|0.001168
2017-09-29T13:38:00.529731|sleep||60


What am I doing wrong? 

Regards,
Marek

johnm

unread,
Sep 29, 2017, 9:11:59 AM9/29/17
to hcron-users
Hi,

Since you are using a rpi, I take it you installed from git/source. I suspect that there are some required directories
that have not been setup. See the postinst file for DEBIAN:

It may be easiest to just copy-paste lines 12-40 (as root). Then retry the hcron-reload (as pi).

Also, to run on the localhost, make sure that the hcron.conf has:
{
   
"localhost": True,
   
...
}

For the hcron.allow, see the docs:

I will provide more information on the setup for those that install from source.

John

johnm

unread,
Sep 29, 2017, 9:33:54 AM9/29/17
to hcron-users
Hi,

Sorry, the key name to use in hcron.allow should be "allow_localhost" not "localhost".

John

Marek Niemczyk

unread,
Sep 29, 2017, 9:47:22 AM9/29/17
to hcron-users
Thank You for Your response!

I was installing hcron from deb package with 

sudo dpkg -i hcron_0.21_all.deb

But I tried to compile it from sources earlier, using "make install" - but I failed. Anyway...

My hcron.conf
# hcron.conf
{
    "allow_localhost": True,
    "allow_root_events": True,
    "command_spawn_timeout": 15,
    "events_base_path": None,
    "log_path": "hcron.log",
    "max_events_per_user": 50,
    # hidden files, emacs backup files
    "names_to_ignore_regexp": "(\..*)|(.*~$)",
    "smtp_server": "localhost",
    "test_net_username": None,
    "use_syslog": False,
}



I executed mentioned lines 12-40 as root, no error message were shown. Then I ran hcron-reload but it didn't help. Error is still there:

2017-09-29T15:38:01.001766|work||0|0.000633
2017-09-29T15:38:01.003708|sleep||59
2017-09-29T15:39:00.030255|message||info|scheduling for next interval (2017-09-29 15:39:00)
2017-09-29T15:39:00.033219|message||info|signalHome was modified
2017-09-29T15:39:00.039914|message||warning|Could not install snapshot file for user (pi).
2017-09-29T15:39:00.042624|work||0|0.000595
2017-09-29T15:39:00.044579|sleep||60
2017-09-29T15:39:00.185166|message||info|scheduling for next interval (2017-09-29 15:39:00)
2017-09-29T15:39:00.188002|message||info|signalHome was modified
2017-09-29T15:39:00.191505|work||0|0.000715
2017-09-29T15:39:00.193457|sleep||60


Maybe I can somehow clean up some directories that might be corrupted and reinstall?

Regards,
Marek

John

unread,
Sep 29, 2017, 9:59:31 AM9/29/17
to hcron...@googlegroups.com
Hi,

What is the output from "hcron-info --fqdn"? That hostname value should be used for
the home of the events:
~/.hcron/<hostname>/events
Is there a file at:
~/.hcron/<hostname>/snapshot
Is the snapshot readable?
tar tvfz ~/.hcron/<hostname>/snapshot
Are the /var/lib/hcron directories in place? If you do:
ls -l /var/lib/hcron
do you see something like:
total 8
drwxr-xr-x 2 root root 4096 Sep 20 08:23 event_lists
drwx------ 2 root root 4096 Sep 20 08:23 tree
What about the /var/spool/hcron? If you do:
ls -ld /var/spool/hcron
do you see something like:
drwxrwxrwt 2 root root 4096 Sep 20 08:23 /var/spool/hcron

John
--
You received this message because you are subscribed to the Google Groups "hcron-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hcron-users...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Marek Niemczyk

unread,
Oct 1, 2017, 5:13:40 PM10/1/17
to hcron-users
Bingo! My snapshot file was in fact a directory (I've created it manually and thought it should be dir) and what is worse, it was owned by root. After granting ownership of ~/.hcron/raspberrypi/ directory to user pi and deleting snapshot dir, snapshot file was created and it worked.

Thank You very much for Your assist :)

Regards,
Marek

johnm

unread,
Oct 1, 2017, 5:16:34 PM10/1/17
to hcron-users
Hi,

Good to hear. I hope it proves useful to you.

John
Reply all
Reply to author
Forward
0 new messages