~ubuntu-branches/ubuntu/trusty/libguestfs/trusty

« back to all changes in this revision

Viewing changes to fish/guestfish.pod

  • Committer: Bazaar Package Importer
  • Author(s): Hilko Bengen
  • Date: 2011-10-20 13:13:00 UTC
  • mto: (1.2.1 upstream) (15.1.1 sid)
  • mto: This revision was merged to the branch mainline in revision 11.
  • Revision ID: james.westby@ubuntu.com-20111020131300-vtuaa253sbrvmn7b
Tags: upstream-1.12.8
ImportĀ upstreamĀ versionĀ 1.12.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
973
973
 
974
974
Guestfish client and server versions must match exactly.
975
975
 
 
976
=head2 USING REMOTE CONTROL ROBUSTLY FROM SHELL SCRIPTS
 
977
 
 
978
From Bash, you can use the following code which creates a guestfish
 
979
instance, correctly quotes the command line, handles failure to start,
 
980
and cleans up guestfish when the script exits:
 
981
 
 
982
 #!/bin/bash -
 
983
 
 
984
 set -e
 
985
 
 
986
 guestfish[0]="guestfish"
 
987
 guestfish[1]="--listen"
 
988
 guestfish[2]="--ro"
 
989
 guestfish[3]="-a"
 
990
 guestfish[4]="disk.img"
 
991
 
 
992
 GUESTFISH_PID=
 
993
 eval $("${guestfish[@]}")
 
994
 if [ -z "$GUESTFISH_PID" ]; then
 
995
     echo "error: guestfish didn't start up, see error messages above"
 
996
     exit 1
 
997
 fi
 
998
 
 
999
 cleanup_guestfish ()
 
1000
 {
 
1001
     guestfish --remote -- exit >/dev/null 2>&1 ||:
 
1002
 }
 
1003
 trap cleanup_guestfish EXIT ERR
 
1004
 
 
1005
 guestfish --remote -- run
 
1006
 
 
1007
 # ...
 
1008
 
976
1009
=head2 REMOTE CONTROL RUN COMMAND HANGING
977
1010
 
978
1011
Using the C<run> (or C<launch>) command remotely in a command