Browse Source

pull/push: refactor external tools invocation

Enrico Tassi 8 years ago
parent
commit
dc08d57366
3 changed files with 21 additions and 4 deletions
  1. 17
    0
      smd-common
  2. 2
    2
      smd-pull
  3. 2
    2
      smd-push

+ 17
- 0
smd-common View File

@@ -536,5 +536,22 @@ run_hooks() {
536 536
 	done
537 537
 }
538 538
 
539
+# running server and client with appropriate parameters
540
+
541
+run_local_client() {
542
+cd $WORKAREA; $SMDCLIENT $CHILDSARGS $SMDCLIENTOPTS -t "$TRANSLATOR_RL" $CLIENTNAME $MAILBOX_REMOTE 
543
+}
544
+
545
+run_local_server() {
546
+cd $WORKAREA; $SMDSERVER $LOCALEXCLUDE $CHILDSARGS $SMDSERVEROPTS $CLIENTNAME $MAILBOX_REMOTE
547
+}
548
+
549
+run_remote_server() {
550
+$SSH $SERVERNAME $REMOTESMDSERVER $REMOTEEXCLUDE $CHILDSARGS $SMDSERVEROPTS $CLIENTNAME $MAILBOX_REMOTE
551
+}
552
+
553
+run_remote_client() {
554
+$SSH $SERVERNAME $REMOTESMDCLIENT $CHILDSARGS $SMDCLIENTOPTS $CLIENTNAME $MAILBOX_REMOTE
555
+}
539 556
 
540 557
 # vim:ts=4 filetype=sh:

+ 2
- 2
smd-pull View File

@@ -52,12 +52,12 @@ atexit_kill $LOGGER2
52 52
 REPORTER=$!
53 53
 atexit_kill $REPORTER
54 54
 
55
-(cd $WORKAREA; $SMDCLIENT $CHILDSARGS $SMDCLIENTOPTS -t "$TRANSLATOR_RL" $CLIENTNAME $MAILBOX_REMOTE < $LtC 2> $PRp) > $CtL &
55
+(run_local_client < $LtC 2> $PRp) > $CtL &
56 56
 CLIENT=$!
57 57
 atexit_kill $CLIENT
58 58
 
59 59
 EXITCODE=0
60
-($SSH $SERVERNAME $REMOTESMDSERVER $REMOTEEXCLUDE $CHILDSARGS $SMDSERVEROPTS $CLIENTNAME $MAILBOX_REMOTE < $LtS 2> $SL) > $StL  || EXITCODE=1
60
+(run_remote_server < $LtS 2> $SL) > $StL  || EXITCODE=1
61 61
 
62 62
 wait $CLIENT || EXITCODE=1 
63 63
 wait $REPORTER || EXITCODE=1 

+ 2
- 2
smd-push View File

@@ -54,12 +54,12 @@ atexit_kill $REPORTER
54 54
 
55 55
 setup_workarea
56 56
 
57
-(cd $WORKAREA; $SMDSERVER $LOCALEXCLUDE $CHILDSARGS $SMDSERVEROPTS $CLIENTNAME $MAILBOX_REMOTE < $LtC 2>> $CL) > $CtL &
57
+(run_local_server < $LtC 2>> $CL) > $CtL &
58 58
 CLIENT=$!
59 59
 atexit_kill $CLIENT
60 60
 
61 61
 EXITCODE=0
62
-($SSH $SERVERNAME $REMOTESMDCLIENT $CHILDSARGS $SMDCLIENTOPTS $CLIENTNAME $MAILBOX_REMOTE < $LtS 2> $PRp) > $StL || EXITCODE=1
62
+(run_remote_client < $LtS 2> $PRp) > $StL || EXITCODE=1
63 63
 
64 64
 wait $CLIENT || EXITCODE=1 
65 65
 wait $REPORTER || EXITCODE=1 

Loading…
Cancel
Save