etc/cron
This commit is contained in:
2
etc/cron.d/.placeholder
Normal file
2
etc/cron.d/.placeholder
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# DO NOT EDIT OR REMOVE
|
||||||
|
# This file is a simple placeholder to keep dpkg from removing this directory
|
||||||
2
etc/cron.d/e2scrub_all
Normal file
2
etc/cron.d/e2scrub_all
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
30 3 * * 0 root test -e /run/systemd/system || SERVICE_MODE=1 /usr/libexec/e2fsprogs/e2scrub_all_cron
|
||||||
|
10 3 * * * root test -e /run/systemd/system || SERVICE_MODE=1 /sbin/e2scrub_all -A -r
|
||||||
14
etc/cron.d/php
Normal file
14
etc/cron.d/php
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# /etc/cron.d/php@PHP_VERSION@: crontab fragment for PHP
|
||||||
|
# This purges session files in session.save_path older than X,
|
||||||
|
# where X is defined in seconds as the largest value of
|
||||||
|
# session.gc_maxlifetime from all your SAPI php.ini files
|
||||||
|
# or 24 minutes if not defined. The script triggers only
|
||||||
|
# when session.save_handler=files.
|
||||||
|
#
|
||||||
|
# WARNING: The scripts tries hard to honour all relevant
|
||||||
|
# session PHP options, but if you do something unusual
|
||||||
|
# you have to disable this script and take care of your
|
||||||
|
# sessions yourself.
|
||||||
|
|
||||||
|
# Look for and purge old sessions every 30 minutes
|
||||||
|
09,39 * * * * root [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi
|
||||||
3
etc/cron.d/popularity-contest
Normal file
3
etc/cron.d/popularity-contest
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
SHELL=/bin/sh
|
||||||
|
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||||
|
46 20 * * * root test -x /etc/cron.daily/popularity-contest && /etc/cron.daily/popularity-contest --crond
|
||||||
2
etc/cron.daily/.placeholder
Normal file
2
etc/cron.daily/.placeholder
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# DO NOT EDIT OR REMOVE
|
||||||
|
# This file is a simple placeholder to keep dpkg from removing this directory
|
||||||
25
etc/cron.daily/apache2
Normal file
25
etc/cron.daily/apache2
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# run htcacheclean if set to 'cron' mode
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -u
|
||||||
|
|
||||||
|
type htcacheclean > /dev/null 2>&1 || exit 0
|
||||||
|
[ -e /etc/default/apache-htcacheclean ] || exit 0
|
||||||
|
|
||||||
|
|
||||||
|
# edit /etc/default/apache-htcacheclean to change this
|
||||||
|
HTCACHECLEAN_MODE=daemon
|
||||||
|
HTCACHECLEAN_RUN=auto
|
||||||
|
HTCACHECLEAN_SIZE=300M
|
||||||
|
HTCACHECLEAN_PATH=/var/cache/apache2/mod_cache_disk
|
||||||
|
HTCACHECLEAN_OPTIONS=""
|
||||||
|
|
||||||
|
. /etc/default/apache-htcacheclean
|
||||||
|
|
||||||
|
[ "$HTCACHECLEAN_MODE" = "cron" ] || exit 0
|
||||||
|
|
||||||
|
htcacheclean ${HTCACHECLEAN_OPTIONS} \
|
||||||
|
-p${HTCACHECLEAN_PATH} \
|
||||||
|
-l${HTCACHECLEAN_SIZE}
|
||||||
55
etc/cron.daily/apt-compat
Normal file
55
etc/cron.daily/apt-compat
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Systemd systems use a systemd timer unit which is preferable to
|
||||||
|
# run. We want to randomize the apt update and unattended-upgrade
|
||||||
|
# runs as much as possible to avoid hitting the mirrors all at the
|
||||||
|
# same time. The systemd time is better at this than the fixed
|
||||||
|
# cron.daily time
|
||||||
|
if [ -d /run/systemd/system ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
check_power()
|
||||||
|
{
|
||||||
|
# laptop check, on_ac_power returns:
|
||||||
|
# 0 (true) System is on main power
|
||||||
|
# 1 (false) System is not on main power
|
||||||
|
# 255 (false) Power status could not be determined
|
||||||
|
# Desktop systems always return 255 it seems
|
||||||
|
if command -v on_ac_power >/dev/null; then
|
||||||
|
if on_ac_power; then
|
||||||
|
:
|
||||||
|
elif [ $? -eq 1 ]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# sleep for a random interval of time (default 30min)
|
||||||
|
# (some code taken from cron-apt, thanks)
|
||||||
|
random_sleep()
|
||||||
|
{
|
||||||
|
RandomSleep=1800
|
||||||
|
eval $(apt-config shell RandomSleep APT::Periodic::RandomSleep)
|
||||||
|
if [ $RandomSleep -eq 0 ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
if [ -z "$RANDOM" ] ; then
|
||||||
|
# A fix for shells that do not have this bash feature.
|
||||||
|
RANDOM=$(( $(dd if=/dev/urandom bs=2 count=1 2> /dev/null | cksum | cut -d' ' -f1) % 32767 ))
|
||||||
|
fi
|
||||||
|
TIME=$(($RANDOM % $RandomSleep))
|
||||||
|
sleep $TIME
|
||||||
|
}
|
||||||
|
|
||||||
|
# delay the job execution by a random amount of time
|
||||||
|
random_sleep
|
||||||
|
|
||||||
|
# ensure we don't do this on battery
|
||||||
|
check_power || exit 0
|
||||||
|
|
||||||
|
# run daily job
|
||||||
|
exec /usr/lib/apt/apt.systemd.daily
|
||||||
34
etc/cron.daily/backup-mariadb
Normal file
34
etc/cron.daily/backup-mariadb
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Sauvegarde quotidienne des bases de données MariaDB
|
||||||
|
# Basé sur le nom de la base : *_utilisateur
|
||||||
|
|
||||||
|
BACKUP_DIR="/var/backups/mysql"
|
||||||
|
RETENTION_DAYS=21
|
||||||
|
DATE=$(date +%F)
|
||||||
|
|
||||||
|
mkdir -p "$BACKUP_DIR"
|
||||||
|
|
||||||
|
# Liste toutes les bases sauf celles internes
|
||||||
|
DBS=$(mysql -N -B -e "SHOW DATABASES;" | grep -Ev "^(information_schema|performance_schema|mysql|sys)$")
|
||||||
|
|
||||||
|
for db in $DBS; do
|
||||||
|
# Récupère l'utilisateur = partie après le dernier "_"
|
||||||
|
user=$(echo "$db" | awk -F'_' '{print $NF}')
|
||||||
|
|
||||||
|
# Si jamais pas d'underscore, on met dans "unknown"
|
||||||
|
[ -z "$user" ] && user="unknown"
|
||||||
|
|
||||||
|
USER_DIR="$BACKUP_DIR/$user"
|
||||||
|
mkdir -p "$USER_DIR"
|
||||||
|
|
||||||
|
FILE="$USER_DIR/${db}_$DATE.sql.gz"
|
||||||
|
|
||||||
|
# Sauvegarde
|
||||||
|
if ! mysqldump --single-transaction "$db" | gzip > "$FILE"; then
|
||||||
|
echo "Erreur lors de la sauvegarde de $db" >&2
|
||||||
|
rm -f "$FILE"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Nettoyage des fichiers plus vieux que 21 jours
|
||||||
|
find "$BACKUP_DIR" -type f -name "*.sql.gz" -mtime +$RETENTION_DAYS -delete
|
||||||
8
etc/cron.daily/dpkg
Normal file
8
etc/cron.daily/dpkg
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Skip if systemd is running.
|
||||||
|
if [ -d /run/systemd/system ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
/usr/libexec/dpkg/dpkg-db-backup
|
||||||
18
etc/cron.daily/logrotate
Normal file
18
etc/cron.daily/logrotate
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# skip in favour of systemd timer
|
||||||
|
if [ -d /run/systemd/system ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# this cronjob persists removals (but not purges)
|
||||||
|
if [ ! -x /usr/sbin/logrotate ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
/usr/sbin/logrotate /etc/logrotate.conf
|
||||||
|
EXITVALUE=$?
|
||||||
|
if [ $EXITVALUE != 0 ]; then
|
||||||
|
/usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
|
||||||
|
fi
|
||||||
|
exit $EXITVALUE
|
||||||
200
etc/cron.daily/popularity-contest
Normal file
200
etc/cron.daily/popularity-contest
Normal file
@@ -0,0 +1,200 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# don't run if this package is removed but not purged
|
||||||
|
if [ ! -f /usr/sbin/popularity-contest ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
MODE="$1"
|
||||||
|
|
||||||
|
unset MAILFROM
|
||||||
|
unset MAILTO
|
||||||
|
unset MY_HOSTID
|
||||||
|
unset PARTICIPATE
|
||||||
|
unset SUBMITURLS
|
||||||
|
unset USEHTTP
|
||||||
|
unset USETOR
|
||||||
|
unset MTAOPS
|
||||||
|
|
||||||
|
TORIFY_PATH=/usr/bin/torify
|
||||||
|
|
||||||
|
torify_enabled() {
|
||||||
|
# Return 1 to enable torify for HTTP submission, otherwise 0; exit on error
|
||||||
|
TORSOCKS_PATH=/usr/bin/torsocks
|
||||||
|
[ -f "$TORIFY_PATH" ] && [ -f "$TORSOCKS_PATH" ] && TOR_AVAILABLE=1
|
||||||
|
|
||||||
|
case "$USETOR" in
|
||||||
|
"yes")
|
||||||
|
if [ -z $TOR_AVAILABLE ]; then
|
||||||
|
echo "popularity-contest: USETOR is set but torify is not available." 2>&1
|
||||||
|
echo "popularity-contest: Please install the tor and torsocks packages." 2>&1
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ "yes" != "$USEHTTP" ]; then
|
||||||
|
echo "popularity-contest: when USETOR is set USEHTTP must be set as well" 2>&1
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
"maybe")
|
||||||
|
[ "yes" = "$USEHTTP" ] && [ ! -z $TOR_AVAILABLE ] && return 0
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
"no")
|
||||||
|
return 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
# get configuration information
|
||||||
|
. /usr/share/popularity-contest/default.conf
|
||||||
|
. /etc/popularity-contest.conf
|
||||||
|
|
||||||
|
if test -d /etc/popularity-contest.d/; then
|
||||||
|
for file in `run-parts --list --regex '\.conf$' /etc/popularity-contest.d/`;
|
||||||
|
do
|
||||||
|
. $file
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# don't run if MAILTO address is blank, and not configured to use HTTP POST!
|
||||||
|
if [ -z "$MAILTO" ] && [ "yes" != "$USEHTTP" ]; then exit 0; fi
|
||||||
|
|
||||||
|
# don't run if PARTICIPATE is "no" or unset!
|
||||||
|
if [ "$PARTICIPATE" = "no" ] || [ -z "$PARTICIPATE" ]; then exit 0; fi
|
||||||
|
|
||||||
|
# enable torify
|
||||||
|
if torify_enabled; then
|
||||||
|
TORIFY=$TORIFY_PATH
|
||||||
|
else
|
||||||
|
TORIFY=''
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ -n "$HTTP_PROXY" ]; then
|
||||||
|
export http_proxy="$HTTP_PROXY";
|
||||||
|
fi
|
||||||
|
|
||||||
|
POPCONVAR="/var/lib/popularity-contest"
|
||||||
|
POPCONOLD="/var/log/popularity-contest"
|
||||||
|
POPCONNEW="/var/log/popularity-contest.$$"
|
||||||
|
POPCON="$POPCONNEW"
|
||||||
|
|
||||||
|
last_sub()
|
||||||
|
{
|
||||||
|
if [ -r "$POPCONVAR/lastsub" ] ; then
|
||||||
|
cat "$POPCONVAR/lastsub"
|
||||||
|
else
|
||||||
|
date -r "$POPCONOLD" +%s
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
set_sub()
|
||||||
|
{
|
||||||
|
test -d "$POPCONVAR" || mkdir -p "$POPCONVAR"
|
||||||
|
date +%s > "$POPCONVAR/lastsub"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Only run on the given day, to spread the load on the server a bit
|
||||||
|
if [ "$MODE" != "--crond" ] || ( [ "$DAY" ] && [ "$DAY" != "$(date +%w)" ] ) ; then
|
||||||
|
# Ensure that popcon runs at least once in the last week
|
||||||
|
if [ -f "$POPCONOLD" ] ; then
|
||||||
|
now=$(date +%s)
|
||||||
|
lastrun=$(last_sub)
|
||||||
|
if [ "$MODE" = "--crond" ]; then
|
||||||
|
# 7.5 days, in seconds
|
||||||
|
week=648000
|
||||||
|
else
|
||||||
|
# 6.5 days, in seconds
|
||||||
|
week=561600
|
||||||
|
fi
|
||||||
|
if [ "$(( $now - $lastrun ))" -le "$week" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# keep old logs
|
||||||
|
cd /var/log
|
||||||
|
umask 022
|
||||||
|
savelog -c 7 popularity-contest >/dev/null
|
||||||
|
|
||||||
|
do_sendmail()
|
||||||
|
{
|
||||||
|
if [ -n "$MAILFROM" ]; then
|
||||||
|
sendmail -oi $MTAOPS -f "$MAILFROM" $MAILTO
|
||||||
|
else
|
||||||
|
sendmail -oi $MTAOPS $MAILTO
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# generate the popularity contest data
|
||||||
|
|
||||||
|
/usr/sbin/popularity-contest --su-nobody > $POPCON
|
||||||
|
|
||||||
|
GPG=/usr/bin/gpg
|
||||||
|
|
||||||
|
if [ "$ENCRYPT" = "yes" ] && ! [ -x "$GPG" ]; then
|
||||||
|
logger -t popularity-contest "encryption required but gpg is not available."
|
||||||
|
echo "popularity-contest: encryption required but gpg is not available." 2>&1
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -x "$GPG" ] && [ "$ENCRYPT" = "maybe" ] || [ "$ENCRYPT" = "yes" ]; then
|
||||||
|
POPCONGPG="$POPCON.gpg"
|
||||||
|
rm -f "$POPCONGPG"
|
||||||
|
GPGHOME=`mktemp -d`
|
||||||
|
$GPG --batch --no-options --no-default-keyring --trust-model=always \
|
||||||
|
--homedir "$GPGHOME" --keyring $KEYRING --quiet \
|
||||||
|
--armor -o "$POPCONGPG" -r $POPCONKEY --encrypt "$POPCON"
|
||||||
|
rm -rf "$GPGHOME"
|
||||||
|
POPCON="$POPCONGPG"
|
||||||
|
fi
|
||||||
|
|
||||||
|
SUBMITTED=no
|
||||||
|
|
||||||
|
# try to post the report through http POST
|
||||||
|
if [ "$SUBMITURLS" ] && [ "yes" = "$USEHTTP" ]; then
|
||||||
|
for URL in $SUBMITURLS ; do
|
||||||
|
if setsid $TORIFY /usr/share/popularity-contest/popcon-upload \
|
||||||
|
-u $URL -f $POPCON 2>/dev/null ; then
|
||||||
|
SUBMITTED=yes
|
||||||
|
set_sub
|
||||||
|
else
|
||||||
|
logger -t popularity-contest "unable to submit report to $URL."
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# try to email the popularity contest data
|
||||||
|
# skip emailing if USETOR is set
|
||||||
|
|
||||||
|
if [ "$MODE" = "--crond" ] && [ yes != "$SUBMITTED" ] && [ yes != "$USETOR" ] && [ "$MAILTO" ]; then
|
||||||
|
if [ -x "`which sendmail 2>/dev/null`" ]; then
|
||||||
|
(
|
||||||
|
if [ -n "$MAILFROM" ]; then
|
||||||
|
echo "From: <$MAILFROM>"
|
||||||
|
echo "Sender: <$MAILFROM>"
|
||||||
|
fi
|
||||||
|
echo "To: $MAILTO"
|
||||||
|
echo "Subject: popularity-contest submission"
|
||||||
|
echo "MIME-Version: 1.0"
|
||||||
|
echo "Content-Type: text/plain"
|
||||||
|
echo
|
||||||
|
cat $POPCON
|
||||||
|
) | do_sendmail
|
||||||
|
SUBMITTED=yes
|
||||||
|
else
|
||||||
|
logger -t popularity-contest "unable to submit report using sendmail."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "yes" != "$SUBMITTED" ] ; then
|
||||||
|
logger -t popularity-contest "unable to submit report."
|
||||||
|
rm -f $POPCONNEW $POPCONNEW.gpg
|
||||||
|
else
|
||||||
|
mv $POPCONNEW $POPCONOLD
|
||||||
|
if [ -n "$POPCONGPG" ]; then
|
||||||
|
mv $POPCONNEW.gpg $POPCONOLD.gpg
|
||||||
|
fi
|
||||||
|
fi
|
||||||
1
etc/cron.daily/prestashop-rebuild-search-index
Normal file
1
etc/cron.daily/prestashop-rebuild-search-index
Normal file
@@ -0,0 +1 @@
|
|||||||
|
curl -s " https://boutique.eureka-informatique.fr/admin592z328wv39xy4bdnvz/?controller=AdminSearch&action=searchCron&ajax=1&full=1&token=hCXLIxFy&id_shop=1 " >/dev/null 2>&1
|
||||||
2
etc/cron.hourly/.placeholder
Normal file
2
etc/cron.hourly/.placeholder
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# DO NOT EDIT OR REMOVE
|
||||||
|
# This file is a simple placeholder to keep dpkg from removing this directory
|
||||||
2
etc/cron.monthly/.placeholder
Normal file
2
etc/cron.monthly/.placeholder
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# DO NOT EDIT OR REMOVE
|
||||||
|
# This file is a simple placeholder to keep dpkg from removing this directory
|
||||||
2
etc/cron.weekly/.placeholder
Normal file
2
etc/cron.weekly/.placeholder
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# DO NOT EDIT OR REMOVE
|
||||||
|
# This file is a simple placeholder to keep dpkg from removing this directory
|
||||||
2
etc/cron.yearly/.placeholder
Normal file
2
etc/cron.yearly/.placeholder
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# DO NOT EDIT OR REMOVE
|
||||||
|
# This file is a simple placeholder to keep dpkg from removing this directory
|
||||||
Reference in New Issue
Block a user