"How to call sudo in a script?"
You can't, or shouldn't if you want the backup to run unattended, and keep your system secure.
Backups are generally best run as root anyway (that way all your users can be backed up).
You could run your backup from root's crontab, then it'd be run as root.
I don't use nssbackup
, (I just use rsync
, which is fast, and easy ) so I can't help you with how it works.