.muttrc Script

From Debian Clusters
Jump to: navigation, search

This is a small script used in Setting up Mutt. To allow mutt to use Maildir format, .muttrc was modified, and this is used for copying that file out to various users on the system.

This script must be run as root.

#!/bin/bash

# Replace this line if your users' directories are stored somewhere else:
HOMEDIR="/home/"

if [ `id -u` != "0" ]  # Are you root?
then
  echo "Error: This script must be run as the root user."
  exit
elif [ ! -e .muttrc ]  # Is .muttrc here?
then
  echo "Error: .muttrc is not in this directory.  Move to a directory where the"
  echo "correct file to be copied exists."
  exit
fi

for x in `ls $HOMEDIR`; do
  cp .muttrc $HOMEDIR$x
  chown $x:$x $HOMEDIR$x/.muttrc

  # Uncomment these if you need to copy .muttrc-local, too...
  # And make sure .muttrc-local is in this directory!
  #cp .muttrc-local $HOMEDIR$x
  #chown $x:$x $HOMEDIR$x/.muttrc-local

  echo "Copied to $HOMEDIR$x ..."
done

echo "Done!"

exit
Personal tools
Namespaces
Variants
Actions
About
services
node images
clustering
web monitoring
Toolbox