Search code examples
bashunixcronmount

remounting file system as rw in unix bash script


Hi all I need to remount a file system as read/write in a bash script

I've looked at several examples and my code looks right..in fact its working. However when I execute the bash file as root it still asks to enter a password. I can't do this as it is going to be run as a CRON job when I'm out of the office. I've tried several variations and none work. Do you guys have any suggestions?

$MOUNT -o remount,rw $BACKUPDIR ;
if (( $? )); then
{
$ECHO "snapshot: could not remount $BACKUPDIR readwrite";
exit;
}

fi;


Solution

  • You can specify the password in the command line:

    -o remount,rw,pass=password