dachev / node-crontab

A module for creating, reading, updating, and deleting system cron jobs
189 stars 35 forks source link

crontab file untouched #27

Closed ThaBrad closed 7 years ago

ThaBrad commented 7 years ago

Hey @dachev

I'm sorry but I didn't get to get anything meaningful out of the library.

I tried running it on an embedded Linux (Busybox OpenWRT) and it doesn't change the crontab (at /etc/crontab) at all. Honestly I read through your library and couldn't find the entry where it would actually access the cron file at all, generally no reference to any file file whatsoever?!

Maybe it's just late and I'm stupid 😝. Anyways, help would be greatly appreciated!

thx

dachev commented 7 years ago

@ThaBrad The library is not writing to the cron file directly. Instead, it executes crontab in a child process.

Does it work when you run this on the command line? echo "* * * * * echo" | crontab -

ThaBrad commented 7 years ago

@dachev Ah ok.

Ok yeah, I see it, but for me the crontab cmd is completely black magic as, when editing with "crontab -e" I get a /tmp/crontab.1KBjzN (crontab. …) file, which obviously stores the content (cause redoing the cmd leads to same content, different filename), but deleted immediately after and the content nowhere else to be found on the drive (find grep "…" …blabla).

So even if that way works (crontab -e), I don't know how to run that (at least with busybox) and it doesn't trigger itself (compared to the /etc/crontab).

Basically my question: How to trigger this user specified (with crontab -e) cronjob?

EDIT: Ok now at least I found the file --> /var/spool/cron/[user], but still no clue how to start that job (memory and/or persistent e.g. reboot resistant)

ThaBrad commented 7 years ago

Btw "systemctl start crond" (+enable) if not failing, but also not changing anything 😞.

ThaBrad commented 7 years ago

Please. I don’t get it to work at all.

On 24 Apr 2017, at 21:28, Blagovest Dachev notifications@github.com wrote:

@ThaBrad https://github.com/ThaBrad The library is not writing to the cron file directly. Instead, it executes crontab in a child process.

Does it work when you run this on the command line? echo " * echo" | crontab -

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/dachev/node-crontab/issues/27#issuecomment-296797542, or mute the thread https://github.com/notifications/unsubscribe-auth/ARV0FdP5GalPbo4GcCHHLkv3fAFrr-hrks5rzPf7gaJpZM4NGlvy.

dachev commented 7 years ago

@ThaBrad If the command I gave you doesn't work this library won't be able to save jobs either. I wish I could help you but I don't have enough time to investigate your particular OS and cron version.

ThaBrad commented 7 years ago

@dachev it works. Entry IS written.

It just doesn't ever get executed! (…although the script definitely works)

EDIT: So also your Library works perfectly and I can write and delete new cron entries and delete, just no execution

dachev commented 7 years ago

Perhaps you script is throwing an error. Start with something simple to establish if it's really not triggered or if it fails. Try to create a cron job along the lines of:

* * * * * echo "test" > ~/deleteme.txt

If you see ~/deleteme.txt in your home directory then the cron deamon is working correctly but your script is failing.

Here are some general resources for debugging cron jobs: https://goo.gl/ivf4zb

ThaBrad commented 7 years ago

@dachev … ok it was apparently a super super weird linking error on my image of this board (although I used absolute paths and all of that) which didn't start node properly. Other board worked flawlessly.

Thx anyways so much!