#!/bin/bash # secret-agent-service-install service-name user-name if [ "~$1" = "~" ]; then echo A service name is required. exit 1 fi if [ "~$2" = "~" ]; then echo A user name is required. exit 1 fi echo Uninstalling the secret-agent service, $1. cygrunsrv --remove $1 echo Adding the \"Log on as a Service\" right for $2. editrights -a SeServiceLogonRight -u $2 echo Installing the secret-agent service, $1. cygrunsrv --install $1 \ --args '/bin/secret-agent-service' \ --disp "Secret Agent $2" \ --desc "Creates an ssh-agent process for $2." \ --path '/bin/bash' \ --shutdown \ --user "$2" echo Starting the secret-agent service, $1. cygrunsrv --start $1