Code Monkey home page Code Monkey logo

cronkeep's Introduction

CronKeep

CronKeep is a web-based crontab management tool which enables teams to have visibility over what cron jobs are scheduled, run jobs on demand, add new cron jobs in a human-friendly way, or pause a cron schedule from going off, without the need for sysadmin-level access.

CronKeep โ€” Add Job screen

Features

  • Run cron jobs on demand
  • Add new jobs in a simple way
  • Pause a cron job schedule
  • Change or delete existing jobs
  • Minimal setup required (no database dependency)

Live Demo

See the app in action at demo.cronkeep.com. Running cron jobs is disabled in the demo app.

Requirements

CronKeep fits nicely into your LAMP stack. Apache and PHP 5.3.23 or newer are required.

The current CronKeep version interacts only with the crontab of the user Apache is running as. This means it will only have access to the jobs added for the user www-data, apache or nobody, depending on your system.

Installation

  • Proceed with installing Composer if you don't already have it.
curl -sS https://getcomposer.org/installer | php
  • Now using this one-liner command, Composer will install CronKeep and all of its dependencies onto your directory of choice (preferably, your www directory):
php composer.phar create-project cronkeep/cronkeep --keep-vcs -s dev /var/www/cronkeep
  • Set up authentication

At this time, the crontab manager does not feature in-app authentication. It is up to the user to set up means of authentication. Please refer to Installation for more details.

License

CronKeep is a free to use application, both for non-profit and commercial organizations, licensed under the terms of Apache License 2.0. Contributions are encouraged.


SensioLabsInsight

cronkeep's People

Contributors

bogdanghervan avatar forecho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cronkeep's Issues

Error on editing and can't add new job

Hi,

Recently installed cronkeep on my Raspberry Pi and seems to be perfect for my need.
But I can't add or edit any cron job.
I have the home page, I see a job created manually but can't edit it. I've the error message "CloseUnable to edit the job at this time". In the console, I've an 404 error on the requested page : http://192.168.0.31/job/edit-form/7677c207

If I try to add a new job, the saving button seems always checked after click. And no new job in the crontab.

Tested with Firefox 50.1.0 and Vivaldi 1.6.689.34

Regards,
Nicolas

CronKeep

Hello,
I'm new to linux and have installed CronKeep on my raspberry PI 3 (Rasbian) as described. Everything seems to be correct but when I launch CronKeep, all planified jobs were listed correctly on my web browser. The problem is when I run job, its in running... mode for a while and nothing happening. Same when I want add a job or even modify a current job.

I would be very greatful, if anyone help me to solve my problem?
Thanks in advance
With regards
Raphy
2017-05-01_14h52_18

Show crontab of users other than Apache's

Currently CronKeep can only interact with the crontab of the user Apache runs as (typically www-data, apache or nobody, depending on the system). Often, this is enough, but we should allow users to interact with crontabs of other users too.

On the back-end, the crontab command invocation should receive the -u argument to specify the user we are reading / writing the crontab for. We would probably need to add the user a member of the Job object, so that a job would still be easily identifiable by its hash (and keep the short URLs like /job/pause/af1d7eda).

On the front-end, we should display a dropdown somewhere. Only users with a non-empty crontab should be initially shown. The list can be expanded to show all system users by selecting the "All Users" option.

Since on most systems Apache doesn't have access to the crontab of other users, instructions on how to grant access rights should be made available as an article linked from the app itself.

Possible ways to implement the user switcher:

  • display a dropdown on the right-hand side of the header;
  • make the name of the current user (the one displayed in the H2 element) suggest that it can be changed and transform it to a dropdown when hovered.

/src/jobs/* directory missing from installation

I did a fresh installation of cronkeep with the exception of running with SSL. I'm not able to edit/delete the default cron job or add a new cron job. Looking at my browser debug window it looks like the JavaScript is referencing the /job/* directory, which I don't have, giving a 404 error. I've made sure www-data has full access to the cronkeep directory; including sub directories. I should also add I'm running this on Raspbian Jessie, which does not use selinux, so I know that's not the issue.

sh: 1: at: not found

I have just installed cronkeep getting this error
on Ubuntu 16.04

`Oh Snap!

at is not available on this system. CronKeep uses this slick command internally to run jobs independently from your web server, whenever you hit "Run". This means you could restart your web server and still have the process running in the background.
Here's the raw output from the command that may help you debug this further:
sh: 1: at: not found`

Jobs are not working

How to check crons are working properly?
I want to check last and next execution time of any job

Custom client-side validation messages not taken into account

jQuery Validation plugin seems to consider only the custom message for the "required" validation method, and not for "digits".

Rule definition:

                'time[specificTime][hour]': {
                    required: function() {
                        return assertTime(SPECIFIC_TIME);
                    },
                    digits: true,
                    range: [0, 23]
                },

Rule messages:

                'time[specificTime][hour]': {
                    required: 'Hour is required',
                    digits: 'Hour should be a valid number',
                },

All rules are affected.

Better emphasize that a cron job schedule is paused

Paused (commented) cron jobs are currently showed on a gray background. We should find a way to make them stand out a bit more.

Possible ways to make it happen:

  • Precede them with an icon suggesting they are paused. The icon would be shown on a separate column, before the "Time" column (so jobs are still aligned one below the other, regardless of their paused condition). Ideally, this icon will only show up for paused schedules to keep the UI clean.
  • Show a "Paused" / "Ready" label after the cron command. We can use the Label concept already available in Bootstrap.

Limit number elements in the Add Job form to 2 digits

We should limit these input type=number elements to 2 digits:

  • time[specificTime][hour]
  • time[specificTime][minute]
  • time[everyHour][step]
  • time[everyHour][minute]
  • time[everyMinute][step]

maxlength doesn't work for number elements, so probably a JavaScript-based approach would be the solution here.

The solution has to account for the fact that contents could be pasted into the field, rather than typed.

Raw time expression client-side validation

We should validate the raw expression ("Time" field) in the Advanced mode of adding / editing cron jobs.

Currently, saving a job with an incorrect time definition is prevented by the crontab utility itself which returns an error message like "-":20: bad day-of-month errors in crontab file, can't install.

/provision/prevent-running-cron-jobs.patch is a difference file, is it correct

/provision/prevent-running-cron-jobs.patch & /provision/google-analytics-tracking-code.patch are difference file, is it correct ?

used cronkeep on windows 7 with Ubontu VM.
can you please help update the file with correct syntax.

/provision/prevent-running-cron-jobs.patch

diff --git src/index.php src/index.php
index 0247e49..119038b 100644
--- src/index.php
+++ src/index.php
@@ -180,6 +180,12 @@ $app->group('/job', function() use ($app) {
+        $app->render(403, array(
+            'error' => true,
+            'msg' => 'Running cron jobs is disabled in the demo application'
+        ));
+        $app->stop();

/provision/google-analytics-tracking-code.patch

diff --git src/application/views/layout.phtml src/application/views/layout.phtml
index a6a1929..2fbea16 100644
--- src/application/views/layout.phtml
+++ src/application/views/layout.phtml
@@ -30,6 +30,16 @@
+    <script>
+        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+            m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+
+        ga('create', 'UA-58144268-1', 'auto');
+        ga('require', 'linkid', 'linkid.js');
+        ga('send', 'pageview');
+    </script>
 </head>
 <body>
     <!-- Fixed navbar -->

Job no longer found when job definition meets leading stray comment

Consider the following scenario.

Initial contents of the crontab:

# stray comment at the top
# Job 1
* * * * * /job/1
* * * * * /job/2

Steps to reproduce

  1. Delete the first job:
    Resulting crontab:
# stray comment at the top of the crontab
* * * * * /job/2
  1. Without refreshing the page, delete the second job.

Expected result

Cron job is successfully deleted, CronKeep reports the crontab as empty and the actual contents of the underlying crontab are:

# stray comment at the top of the crontab

Actual result

"Cron job no longer exists" error message is displayed.

This is because the crontab is read again in the delete action, and the hash passed in the delete request no longer matches the hash of the cron which adopts the stray comment above and becomes:

# stray comment at the top of the crontab
* * * * * /job/2

Custom error handlers colliding

The error handler set by the SlimJson middleware collides with our own error handler. We need to somehow merge the two error handlers.

Right now, any exception thrown in any of the routes returning JSON shows up in the response as {e:{}}, since the thought-to-be-global error handler overrides the one set by the SlimJson middleware.

PAM configuration prevents Apache from reading its crontab

Error as reported by CronKeep:

System error You (apache) are not allowed to access to (crontab) because of pam configuration.

Originally found this issue on a CentOS 6.4 server with PHP 5.3.25.

We should better handle this situation (inform the user and present options).

Log entries associated with this situation:

==> /var/log/secure <==
Dec 25 10:49:48 localhost crontab: pam_access(crond:account): login_access: user=apache, from=cron, file=/etc/security/access.conf

==> /var/log/audit/audit.log <==
type=AVC msg=audit(1419504588.145:797): avc:  denied  { read } for  pid=3191 comm="unix_chkpwd" name="shadow" dev=dm-0 ino=394249 scontext=unconfined_u:system_r:httpd_t:s0 tcontext=system_u:object_r:shadow_t:s0 tclass=file
type=SYSCALL msg=audit(1419504588.145:797): arch=c000003e syscall=2 success=no exit=-13 a0=7ff518d256bb a1=80000 a2=1b6 a3=0 items=0 ppid=3190 pid=3191 auid=500 uid=0 gid=48 euid=0 suid=0 fsuid=0 egid=48 sgid=48 fsgid=48 tty=(none) ses=3 comm="unix_chkpwd" exe="/sbin/unix_chkpwd" subj=unconfined_u:system_r:httpd_t:s0 key=(null)

==> /var/log/secure <==
Dec 25 10:49:48 localhost unix_chkpwd[3191]: could not obtain user info (apache)
Dec 25 10:49:48 localhost crontab: PAM audit_open() failed: Permission denied
Dec 25 10:49:48 localhost crontab: PAM audit_open() failed: Permission denied

==> /var/log/audit/audit.log <==
type=AVC msg=audit(1419504588.146:798): avc:  denied  { create } for  pid=3190 comm="crontab" scontext=unconfined_u:system_r:httpd_t:s0 tcontext=unconfined_u:system_r:httpd_t:s0 tclass=netlink_audit_socket
type=SYSCALL msg=audit(1419504588.146:798): arch=c000003e syscall=41 success=no exit=-13 a0=10 a1=3 a2=9 a3=7fffab7d1ff0 items=0 ppid=2764 pid=3190 auid=500 uid=48 gid=48 euid=0 suid=0 fsuid=0 egid=48 sgid=48 fsgid=48 tty=(none) ses=3 comm="crontab" exe="/usr/bin/crontab" subj=unconfined_u:system_r:httpd_t:s0 key=(null)

Cron does not execute

It does not execute a created task.

Only if I create as root user.

What should I do?

Pause Job with ### instead of # tag

Hi,

Want to adapt cronkeep to my server panel that is already installed.
In order to do this and to have cronjobs visible in server panel and in cronkeep i need to make a small modification.

When job is PAUSED it should be like this:

### curl http://google.com
instead of as now: # curl http://google.com

I have already modificed the PAUSE action in Job.php:
protected function _updateRaw()
....
. ($this->_isPaused ? '### ' : '')

But when job gets paused, it is not displayed at all in crons list as it has ###

Please assist, thank you!

Make running cron jobs on demand more reliable

Sometimes running cron jobs from the interface fails, and it does so in a silent way, still reporting that the job has started.

CronKeep should (better) report that a cron job failed to run and present the user with whatever information it has available (such as the command's output or the return code).

Capturing command output could be tricky to do with the current setup of running the command asynchronously (which is either scheduling it to run immediately using at, or via proc_open otherwise). CronKeep currently passes on the intricacies of invoking the process to symfony/Process, which uses proc_open internally.

We should strive to keep it running separately from Apache, if possible, which is what at currently does for us.

A nice to have: have output coming up on the screen as the process is being executed (TBD).

Cronjob footprint

Please add the time stamp of the active jobs when it was last run.
Also add an option to view log of the cronjob.

Fully support @reboot shorthand

Even though such cron jobs are correctly displayed in the jobs grid and new jobs can be added, they can't be edited.

We should add support for the @reboot time expression to Expression.php. Users will be able to edit this kind of jobs in the Advanced tab of the Edit form.

See crontab(1) for more information

After installing via composer on a Linux (Debian Jesse) server, I went to http://[host]/cronkeep/src/ in a browser. I received the following error:
There has been an error reading the crontab. Here's the output from the shell: You (daemon) are not allowed to use this program (crontab) See crontab(1) for more information

Where is crontab(1)? I couldn't find anything in the Wiki to help.

Detect when Apache is denied access from /etc/cron.deny

Access to cron can be allowed / revoked on a by-user basis by listing such users in /etc/cron.allow and /etc/cron.deny.

We should better detect when access is restricted and tell the CronKeep user how to fix it.

Also, details about this condition should be added to the Troubleshooting section of the Installation page.

Validation messages not cleared when button groups become valid

Validation messages for the Days selector (in the "Monthly" repeat section) and for the Day of Week selector (in the "Weekly" repeat section) are not being removed after the fields become valid.

The selectors are built using toggle-able Bootstrap button groups. We probably need to manually trigger the "change" event on the underlying multi checkbox controls.

Floating notifications

We should use floating Google-like notifications for Run, Pause and Resume activities.

Using this type of notifications prevents page from scrolling to top when a notification is dispatched and can be seen more easily by our users.

We could use CodeSeven/toastr. Demo here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.