#!/bin/bash set -e sleep 5 # waits for the vpn to have an established connection echo "Starting NAS sync" mount -t cifs "//$1" -o credentials=/sync/nas_login.config /sync/remote_files echo "Successfully mounted SAMBA remote: $1 --> /sync/remote_files" shift # consumes the variable set in $1 so tat $@ only contains the remaining arguments exec "$@"