Parcourir la source

Initial commit

master
révision
44cc2666a9
Signé par: beepboopbelong <beepboopbelong@firemail.cc> ID de la clé GPG: B873A12869A7BD29
2 fichiers modifiés avec 35 ajouts et 0 suppressions
  1. +15
    -0
      setup.sh
  2. +20
    -0
      update_page.sh

+ 15
- 0
setup.sh Voir le fichier

@@ -0,0 +1,15 @@
#!/bin/bash
USER=$(whoami)
CRON_DIR=/var/spool/cron/$USER
CRON_JOB="0 0 * * * /home/$USER/update_page.sh" # a simple cron job that runs everyday

# allow user to add cron commands
sudo echo $USER >> /etc/cron.allow
# setup a cron file for the user
sudo touch $CRON_DIR
sudo /usr/bin/crontab $CRON_DIR
# setup the cron job
sudo echo $CRON_JOB >> $CRON_DIR

echo "Checking cronjobs..."
sudo crontab -u $USER -l

+ 20
- 0
update_page.sh Voir le fichier

@@ -0,0 +1,20 @@
#!/bin/bash
GIT_URL=https://git.lain.church/Jellyman-Group/Sern-Site.git
OUTPUT_DIR=~/site
WWW_DIR=/var/www/html/
WWW_DATA_USER=www-data

# remove the old site
rm -rf $OUTPUT_DIR

# clone the new site
git clone $GIT_URL $OUTPUT_DIR

# Remove the README.md from the dir
rm $OUTPUT_DIR/README.md

# Copy data to webdir
sudo cp $OUTPUT_DIR/* $WWW_DIR

# Change ownership
sudo chown -R $WWW_DATA_USER:$WWW_DATA_USER $WWW_DIR

Chargement…
Annuler
Enregistrer