Files
debian-web-server/bin/postgresqlbackup.sh
T
bachirandClaude Sonnet 5 7ff4df1173 Fix installer bugs: broken root checks, PHP version mismatches, dead paths
- Replace $EUID with $(id -u) for root checks across all bin/*.sh and
  install.sh: dash (Debian's /bin/sh) never sets $EUID, so the check was
  silently broken everywhere.
- lemp.sh: make apt-get upgrade non-interactive (--yes), align the Redis
  PHP module and php-fpm restart with $PHP_VERSION instead of a hardcoded
  8.1, and template the nginx PHP-FPM socket path via a PHP_FPM_SOCK
  placeholder substituted at install time.
- nginx-phpmyadmin.conf: fix docroot to match the actual phpMyAdmin
  symlink location created by lemp.sh.
- mysql-db.sh: inline the root check instead of sourcing the
  nonexistent bin/checkroot.sh.
- webhook.sh: fix chowm typo (chown).
- urbackup.sh: copy the systemd unit from assets/ instead of a relative
  path to a file that doesn't exist in the repo.
- _addUserSite.sh: fix invalid `$var=value` assignment and an empty
  if-block that was a POSIX sh syntax error.

Also carries over pending fixes to deploy-drupal.sh (drush now
invoked via vendor/bin/drush) and gitbarrerepos.sh (comment cleanup).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-04 09:28:08 +02:00

55 lines
1.5 KiB
Bash
Executable File

#!/bin/sh
echo -e '\033[35m
___ _ ___ ___ _ ___ _
| _ \___ __| |_ __ _ _ _ ___/ __|/ _ \| | | _ ) __ _ __| |___ _ _ __
| _/ _ (_-< _/ _. | ._/ -_)__ \ (_) | |__ | _ \/ _. / _| / / || | ._ \
|_| \___/__/\__\__, |_| \___|___/\__\_\____| |___/\__,_\__|_\_\\_,_| .__/
|___/ |_|
\033[0m'
if [ "$(id -u)" -ne 0 ]; then
echo "Please run as root"
exit
fi
# get the current position
_cwd="$(pwd)"
# check for assets forlder
_assets="$_cwd/assets"
if [ ! -d "$_assets" ]; then
_assets="$_cwd/../assets"
if [ ! -d "$_assets" ]; then
echo "!! can't find assets directory !!"
exit
fi
fi
# adding the script
cp "$_assets"/pgsqlbackup.sh /usr/local/bin/
chmod +x /usr/local/bin/pgsqlbackup.sh
# configure
echo -n "Please provide the postgresql host : "
read _pg_host
sed -i "s/HOST/$_pg_host/g" /usr/local/bin/pgsqlbackup.sh
echo -n "Please provide the postgresql port : "
read _pg_port
sed -i "s/PORT/$_pg_port/g" /usr/local/bin/pgsqlbackup.sh
echo -n "Please provide the postgresql user : "
read _pg_user
sed -i "s/USER/$_pg_user/g" /usr/local/bin/pgsqlbackup.sh
echo -n "Please provide the postgresql passwd : "
read _pg_passwd
sed -i "s/PASSWD/$_pg_passwd/g" /usr/local/bin/pgsqlbackup.sh
# creating crontab
touch /var/spool/cron/crontabs/root
crontab -l > /tmp/mycron
echo "30 2 */2 * * /usr/local/bin/pgsqlbackup.sh" >> /tmp/mycron
crontab /tmp/mycron
rm /tmp/mycron