mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-08-05 08:57:50 +00:00
Merge pull request #100 from vpeter4/dcron
dcron: Lightweight cron daemon
This commit is contained in:
commit
ca743de6ea
33
packages/addons/service/system/dcron/addon
Executable file
33
packages/addons/service/system/dcron/addon
Executable file
@ -0,0 +1,33 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# This file is part of OpenELEC - http://www.openelec.tv
|
||||||
|
# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv)
|
||||||
|
# Copyright (C) 2011-2011 Gregor Fuis (gujs@openelec.tv)
|
||||||
|
#
|
||||||
|
# This Program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
#
|
||||||
|
# This Program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with OpenELEC.tv; see the file COPYING. If not, write to
|
||||||
|
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
# http://www.gnu.org/copyleft/gpl.html
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
. config/options $1
|
||||||
|
|
||||||
|
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/bin/
|
||||||
|
cp -Pa $PKG_BUILD/crond $ADDON_BUILD/$PKG_ADDON_ID/bin/
|
||||||
|
cp -Pa $PKG_BUILD/crontab $ADDON_BUILD/$PKG_ADDON_ID/bin/
|
||||||
|
cp -Pa $PKG_BUILD/extra/run-cron $ADDON_BUILD/$PKG_ADDON_ID/bin/
|
||||||
|
cp -Pa $BUILD/nano-*/src/nano $ADDON_BUILD/$PKG_ADDON_ID/bin/
|
||||||
|
|
||||||
|
mkdir -p $ADDON_BUILD/$PKG_ADDON_ID/config/
|
||||||
|
cp -Pa $PKG_DIR/config/* $ADDON_BUILD/$PKG_ADDON_ID/config/
|
35
packages/addons/service/system/dcron/build
Executable file
35
packages/addons/service/system/dcron/build
Executable file
@ -0,0 +1,35 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# This file is part of OpenELEC - http://www.openelec.tv
|
||||||
|
# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv)
|
||||||
|
#
|
||||||
|
# This Program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
#
|
||||||
|
# This Program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with OpenELEC.tv; see the file COPYING. If not, write to
|
||||||
|
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
# http://www.gnu.org/copyleft/gpl.html
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
. config/options $1
|
||||||
|
|
||||||
|
cd $PKG_BUILD
|
||||||
|
|
||||||
|
ADDON_DIR="/storage/.xbmc/addons/service.system.dcron/"
|
||||||
|
ADDON_HOME="/storage/.xbmc/userdata/addon_data/service.system.dcron"
|
||||||
|
|
||||||
|
sed -i "s|/usr/bin/vi|$ADDON_DIR/bin/nano|g" defs.h
|
||||||
|
|
||||||
|
$MAKE \
|
||||||
|
CRONTABS=$ADDON_HOME/crontabs \
|
||||||
|
CRONSTAMPS=$ADDON_HOME/cronstamps \
|
||||||
|
SCRONTABS=$ADDON_HOME/cron.d
|
2
packages/addons/service/system/dcron/changelog.txt
Normal file
2
packages/addons/service/system/dcron/changelog.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
2.0
|
||||||
|
- initial version for dcron 4.5
|
13
packages/addons/service/system/dcron/config/prune-cronstamps
Normal file
13
packages/addons/service/system/dcron/config/prune-cronstamps
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# /etc/cron.d/prune-cronstamps
|
||||||
|
|
||||||
|
# Prunes any files in /var/spool/cron/cronstamps that haven't been used in ninety
|
||||||
|
# days. We check that both mtime and atime are greater than this:
|
||||||
|
#
|
||||||
|
# atime because the cronstamp may be in use (crond is reading it) but the
|
||||||
|
# job keeps failing. So the cronstamp hasn't yet been updated.
|
||||||
|
#
|
||||||
|
# mtime because the volume the cronstamp is located on may be mounted noatime
|
||||||
|
# and so its atime won't be updated. At least its mtime will be updated when
|
||||||
|
# it's modified.
|
||||||
|
|
||||||
|
@weekly ID=prune-cronstamps find /storage/.xbmc/userdata/addon_data/service.system.dcron/cronstamps -type f -mtime +90 -atime +90 -delete
|
12
packages/addons/service/system/dcron/config/root.crond
Normal file
12
packages/addons/service/system/dcron/config/root.crond
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# root crontab
|
||||||
|
# DO NOT EDIT THIS FILE MANUALLY! USE crontab -e INSTEAD
|
||||||
|
|
||||||
|
# man 1 crontab for acceptable formats:
|
||||||
|
# <minute> <hour> <day> <month> <dow> <tags and command>
|
||||||
|
# <@freq> <tags and command>
|
||||||
|
|
||||||
|
# SYSTEM DAILY/WEEKLY/... FOLDERS
|
||||||
|
@hourly ID=sys-hourly /storage/.xbmc/addons/service.system.dcron/bin/run-cron /storage/.xbmc/userdata/addon_data/service.system.dcron/cron.hourly
|
||||||
|
@daily ID=sys-daily /storage/.xbmc/addons/service.system.dcron/bin/run-cron /storage/.xbmc/userdata/addon_data/service.system.dcron/cron.daily
|
||||||
|
@weekly ID=sys-weekly /storage/.xbmc/addons/service.system.dcron/bin/run-cron /storage/.xbmc/userdata/addon_data/service.system.dcron/cron.weekly
|
||||||
|
@monthly ID=sys-monthly /storage/.xbmc/addons/service.system.dcron/bin/run-cron /storage/.xbmc/userdata/addon_data/service.system.dcron/cron.monthly
|
BIN
packages/addons/service/system/dcron/icon/icon.png
Normal file
BIN
packages/addons/service/system/dcron/icon/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 50 KiB |
37
packages/addons/service/system/dcron/meta
Executable file
37
packages/addons/service/system/dcron/meta
Executable file
@ -0,0 +1,37 @@
|
|||||||
|
################################################################################
|
||||||
|
# This file is part of OpenELEC - http://www.openelec.tv
|
||||||
|
# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv)
|
||||||
|
# Copyright (C) 2011-2011 Gregor Fuis (gujs@openelec.tv)
|
||||||
|
#
|
||||||
|
# This Program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
#
|
||||||
|
# This Program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with OpenELEC.tv; see the file COPYING. If not, write to
|
||||||
|
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
# http://www.gnu.org/copyleft/gpl.html
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
PKG_NAME="dcron"
|
||||||
|
PKG_VERSION="4.5"
|
||||||
|
PKG_REV="1"
|
||||||
|
PKG_ARCH="any"
|
||||||
|
PKG_LICENSE="GPL"
|
||||||
|
PKG_SITE="http://www.jimpryor.net/linux/dcron.html"
|
||||||
|
PKG_URL="http://www.jimpryor.net/linux/releases/${PKG_NAME}-${PKG_VERSION}.tar.gz"
|
||||||
|
PKG_DEPENDS=""
|
||||||
|
PKG_BUILD_DEPENDS="toolchain nano"
|
||||||
|
PKG_PRIORITY="optional"
|
||||||
|
PKG_SECTION="service/system"
|
||||||
|
PKG_SHORTDESC="This lightweight cron daemon aims to be simple and secure, with just enough features to stay useful."
|
||||||
|
PKG_LONGDESC="This lightweight cron daemon aims to be simple and secure, with just enough features to stay useful."
|
||||||
|
PKG_IS_ADDON="yes"
|
||||||
|
PKG_ADDON_TYPE="xbmc.service"
|
||||||
|
PKG_AUTORECONF="no"
|
48
packages/addons/service/system/dcron/source/bin/dcron.service
Executable file
48
packages/addons/service/system/dcron/source/bin/dcron.service
Executable file
@ -0,0 +1,48 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# This file is part of OpenELEC - http://www.openelec.tv
|
||||||
|
# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv)
|
||||||
|
#
|
||||||
|
# This Program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
#
|
||||||
|
# This Program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with OpenELEC.tv; see the file COPYING. If not, write to
|
||||||
|
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
# http://www.gnu.org/copyleft/gpl.html
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
ADDON_NAME="service.system.dcron"
|
||||||
|
ADDON_DIR="$HOME/.xbmc/addons/$ADDON_NAME"
|
||||||
|
ADDON_HOME="$HOME/.xbmc/userdata/addon_data/$ADDON_NAME"
|
||||||
|
|
||||||
|
mkdir -p $ADDON_HOME
|
||||||
|
|
||||||
|
if [ ! -d $ADDON_HOME/crontabs ]; then
|
||||||
|
mkdir -p $ADDON_HOME/cron.hourly
|
||||||
|
mkdir -p $ADDON_HOME/cron.daily
|
||||||
|
mkdir -p $ADDON_HOME/cron.weekly
|
||||||
|
mkdir -p $ADDON_HOME/cron.monthly
|
||||||
|
|
||||||
|
mkdir -p $ADDON_HOME/crontabs
|
||||||
|
mkdir -p $ADDON_HOME/cronstamps
|
||||||
|
mkdir -p $ADDON_HOME/cron.d
|
||||||
|
|
||||||
|
cp $ADDON_DIR/config/root.crond $ADDON_HOME/cron.d/root
|
||||||
|
cp $ADDON_DIR/config/prune-cronstamps $ADDON_HOME/cron.d/
|
||||||
|
cp $ADDON_DIR/config/root.crontabs $ADDON_HOME/crontabs/root
|
||||||
|
fi
|
||||||
|
|
||||||
|
export PATH=$ADDON_DIR/bin:$PATH
|
||||||
|
|
||||||
|
if [ -z "$(pidof crond)" ]; then
|
||||||
|
crond -b -l info
|
||||||
|
fi
|
33
packages/addons/service/system/dcron/source/default.py
Executable file
33
packages/addons/service/system/dcron/source/default.py
Executable file
@ -0,0 +1,33 @@
|
|||||||
|
################################################################################
|
||||||
|
# This file is part of OpenELEC - http://www.openelec.tv
|
||||||
|
# Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv)
|
||||||
|
# Copyright (C) 2011-2011 Gregor Fuis (gujs@openelec.tv)
|
||||||
|
#
|
||||||
|
# This Program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
#
|
||||||
|
# This Program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with OpenELEC.tv; see the file COPYING. If not, write to
|
||||||
|
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
# http://www.gnu.org/copyleft/gpl.html
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import xbmcaddon
|
||||||
|
|
||||||
|
__scriptname__ = "Lightweight cron daemon"
|
||||||
|
__author__ = "OpenELEC"
|
||||||
|
__url__ = "http://www.openelec.tv"
|
||||||
|
__settings__ = xbmcaddon.Addon(id='service.system.dcron')
|
||||||
|
__cwd__ = __settings__.getAddonInfo('path')
|
||||||
|
__path__ = xbmc.translatePath( os.path.join( __cwd__, 'bin', "dcron.service") )
|
||||||
|
|
||||||
|
os.system(__path__)
|
Loading…
x
Reference in New Issue
Block a user