alseambusher / crontab-ui

Easy and safe way to manage your crontab file
https://lifepluslinux.blogspot.com/2015/06/crontab-ui-easy-and-safe-way-to-manage.html
MIT License
2.84k stars 475 forks source link

dockerized crontab-ui jobs will not run without trick #208

Open tayyebi opened 1 year ago

tayyebi commented 1 year ago

Before all thank you for your amazing project!

I'm using this cool tool on docker. My docker-compose.yml is shown below:

version: '3.7'

services:
  crontab-ui:
    container_name: crontab-ui
    build: .
    image: alseambusher/crontab-ui
    network_mode: bridge
    ports:
      - 3030:8000
    env_file: variables.env
    volumes:
      # - /var/spool/cron/crontabs/my_username_here:/etc/crontabs/root
      - /etc/cron.d:/etc/crontabs
      - ./data/crontabs:/crontab-ui/crontabs

As you already know **If we are decided to add a cronjob to cron.d, we have to mention the username, after time configuration. So, this will work for crontab -e:

* * * * * wall Hello from crontabs $(date)

But it will definitely not work in cron.d and it should be:

* * * * * wall my_username_here Hello from cron.d $(date)

As you can see in the image below, I used the last time text box to define my username! Can we add an input for that? (I'll be honored to volunteer this task, if you let me know your idea about it.)

image

Cheers

tayyebi commented 1 year ago

Crontab-UI home page (Please kindly pay attention to time column):

image

Result on my host machine:

image

icemtel commented 1 year ago

Hey @tayyebi I don't completely understand your problem, but why wouldn't you add your username as a part of the "Command" field?

icemtel commented 1 year ago

Unrelated to your issue, but you probably understand this better than I do:

tayyebi commented 1 year ago

Dear @icemtel it's working like a charm!

but why wouldn't you add your username as a part of the "Command" field?

Because if add add the username in command field, the saved file will contain ((({ username_here which will not work!

tayyebi commented 1 year ago

Does it update the crontab file only if "save to crontab" is pressed?

Short answer: YES.

As I wanted to use this container to configure cronjobs on my host machine, I linked /etc/cron.d:/etc/crontabs in my docker-compose.yml.

If I want to summarize, it will be so nice, if we could have another field, right after cron expression (and before ((({), for username.

Cheers.

stale[bot] commented 10 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

asule90 commented 8 months ago

hey @tayyebi i have the same problem.. i followed your workaround, but still not working.. did you find the solution?

i got

(*system*root) RELOAD (/etc/cron.d/root)
Error: bad username; while reading /etc/cron.d/root
(*system*root) ERROR (Syntax error, this crontab file will be ignored)

in /var/log/syslog

asule90 commented 8 months ago

nevermind.. it works, it didn't because one of the cron did not use this trick, so the whole file was ignored..

If I want to summarize, it will be so nice, if we could have another field, right after cron expression (and before ((({), for username.

agree, i hope it is on the roadmap..

thanks..