Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tayyebi opened this issue Sep 14, 2022 · 8 comments
Open

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

tayyebi opened this issue Sep 14, 2022 · 8 comments

Comments

@tayyebi
Copy link

tayyebi commented Sep 14, 2022

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
Copy link
Author

tayyebi commented Sep 14, 2022

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

image

Result on my host machine:

image

@icemtel
Copy link

icemtel commented Oct 11, 2022

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
Copy link

icemtel commented Oct 11, 2022

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

  • Does crontab-ui installed with docker work properly (meaning that it can read and write to the real crontab file and see execution log) only if the crontabs folder is mounted?
  • Does it update the crontab file only if "save to crontab" is pressed?

@tayyebi
Copy link
Author

tayyebi commented Nov 11, 2022

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
Copy link
Author

tayyebi commented Nov 11, 2022

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.

Copy link

stale bot commented Nov 11, 2023

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.

@stale stale bot added the wontfix label Nov 11, 2023
@asule90
Copy link

asule90 commented Jan 9, 2024

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
Copy link

asule90 commented Jan 9, 2024

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..

@stale stale bot removed the wontfix label Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants