Nieuws:

Welkom, Gast. Alsjeblieft inloggen of registreren.
Heb je de activerings-mail niet ontvangen?

Auteur Topic: scripts executable maken  (gelezen 918 keer)

pbecks

  • Gast
scripts executable maken
« Gepost op: 2008/03/07, 09:15:28 »
Hallo allemaal,

Ik heb een map (en daarin submappen) met executable scripts. Deze backup ik naar een ftp-map met behulp van het onderstaande script:

***************************************************************

#!/bin/bash
# Shell script to copy all files recursively and upload them to
# remote FTP server (copy local all directories/tree to remote ftp server)
#
# If you want to use this script in cron then make sure you have
# file pointed by $AUTHFILE (see below) and add lines to it:
# host ftp.mycorp.com
# user myftpuser
# pass mypassword
#
# This is a free shell script under GNU GPL version 2.0 or above
# Copyright (C) 2005 nixCraft
# Feedback/comment/suggestions : http://cyberciti.biz/fb/
# -------------------------------------------------------------------------
# This script is part of nixCraft shell script collection (NSSC)
# Visit http://bash.cyberciti.biz/ for more information.
# -------------------------------------------------------------------------
FTP="/usr/bin/ncftpput"
CMD=""
AUTHFILE="/root/.myupload"
                
if [ -f $AUTHFILE ] ; then
  # use the file for auth
  CMD="$FTP -m -R -f $AUTHFILE $myf $remotedir $localdir"
else
  echo "*** To terminate at any point hit [ CTRL + C ] ***"
myf=ftpmap.isp.nl
myu=inlognaam
myp=wachtwoord
 #read -s -p "Enter ftp password : " myp
  #echo ""
remotedir="/ubuntu_werk"
localdir="/home/patrick/scripts"
  [ "$remotedir" == "" ] && remotedir="/" || :
  [ "$localdir" == "" ] && localdir="." || :
  CMD="$FTP -m -R -u $myu -p $myp $myf $remotedir $localdir"
fi
$CMD
exit

************************************************************

Als ik echter op een andere pc de backup terug zet dan zijn er sh-files die niet meer executable zijn. (die moet ik dan met de hand weer executable maken)

Hoe kan dat geautomatiseerd?

ps: Als ik chmod a+x *.sh doe dan blijft het commando hangen op een opstaand script (waarvan de owner de root is). Ik ben zelf natuurlijk NIET ingelogd als root.

voorbeeld:
chmod 755 ~/scripts/backup_conky_scripts.sh doet het ook niet. (geen foutmelding)

?

Offline BlackBurn

  • Lid
    • http://www.robmaas.eu
scripts executable maken
« Reactie #1 Gepost op: 2008/03/07, 11:11:50 »
Het onderste commando kun je natuurlijk altijd uitvoeren met sudo, maar dat terzijde.


Naar welk type bestandssysteem schrijf je de back-up weg en in welk formaat 1op1 of gecomprimeerd?

edit: ik moet echt leren lezen.

Maar dit zou misschien een oplossing kunnen zijn, probeer eens de bestanden in te pakken en dan te uppen en weer terug te halen, staan de permissies dan nog wel goed?
Live to win, dare to lose
http://www.robmaas.eu