Add grav daily cron to check available update.
This commit is contained in:
parent
9217d0ec02
commit
4b73c35d9e
|
@ -0,0 +1,7 @@
|
|||
|
||||
* grav_cron_: A daily cron to check if [grav website][Grav] got available updates.
|
||||
* It need to work from the Grav's root directory.
|
||||
* If an update is available, it will create a empty file (${GRAV_ROOT}/logs/update), else it will ensure the "update" file is removed.
|
||||
|
||||
|
||||
[grav website]: https://getgrav.org/
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/sh
|
||||
|
||||
GRAV_ROOT="/var/www/grav"
|
||||
GRAV_UPDATE_LOG="${GRAV_ROOT}/logs/update"
|
||||
|
||||
# Need to work in the Grav root directory
|
||||
cd "${GRAV_ROOT}" || exit 1
|
||||
|
||||
# Display the Grav's version and check if an update is available
|
||||
GRAV_UPDATE=$("${GRAV_ROOT}"/bin/gpm version|grep upgradable)
|
||||
|
||||
# Verify if the variable contains something
|
||||
if [ -z "${GRAV_UPDATE}" ]; then
|
||||
rm -f "${GRAV_UPDATE_LOG}"
|
||||
else
|
||||
touch "${GRAV_UPDATE_LOG}"
|
||||
fi
|
||||
|
||||
exit 0
|
Loading…
Reference in New Issue