Darkland | net

Apache2/Dotclear Sites Script

Published on 15 May, 2020 by Amanda
#!/bin/bash
########################################
# Filename: sites
#
#
# Creates, lists, or removes symbolic links
# in /etc/apache2/site-enabled
#
########################################
if [ $1 ] ; then

    case $1 in
    -c) cd /etc/apache2/sites-enabled
           printf "\nsites-available : " & ls /etc/apache2/sites-available
           printf "sites-enabled : " & ls /etc/apache2/sites-enabled
           printf "\n\n"
           read -p "Create target : " target
           sudo ln -s ../sites-available/$target $target
           exit 0 ;;

    -r) cd /etc/apache2/sites-enabled
           printf "\nsites-available : " & ls -l /etc/apache2/sites-available
           printf "sites-enabled : " & ls -l /etc/apache2/sites-enabled
           printf "\n\n"
           read -p "Remove target : " target
           sudo rm ./$target
           exit 0 ;;

    -l) printf "sites-available: \n" & ls /etc/apache2/sites-available
           printf "sites-enabled: \n" & ls /etc/apache2/sites-enabled
               exit 0 ;;

    *) printf "\nusage: sites -[c|r|l]\n\n"

    esac

else
    printf "\nusage: sites -[c|r|l]\n\n"
fi
Back