Now we move around from time to time. So sometimes I have a different printer I need to share with the server. And since I also want to share a single folder with the server (not my entire filesystem like the TerminalServer client would like), so I decided to write a bash script to help me decide where I am.
startremote.sh:
#!/bin/bashYou could of course also always share both printers, rdesktop won't complain if it isn't connected, but I'm always looking for stuff to program. And this way you can kind-of create different profiles for different locations.
# Ask where we are, since we don't know where we might end up we add 'other'
# which will default to no extra parameters
srem_WL=$(zenity --list --text="Were Are You?" --radiolist --column="Pick" --column="Locations" TRUE location1 FALSE location2 FALSE other)
# Only do something if cancel wasn't pressed
if [ -n "$srem_WL" ]; then
# The user on the server, I use $USER because I know that on this PC I'll
# always be logged in under the same name as on the server
srem_usr=$USER
# The IP address of the server
srem_ip=0.0.0.0
# The size I want my screen to be
# I add the -g here because one might want fullscreen (with -f)
srem_geo="-g 1910x1120"
# The shares I want to send along
srem_share="-r disk:ShareName=/path/to/some/share"
# The start of my execute command
srem_ex="rdesktop $srem_geo $srem_share"
if [ -n $srem_WL ]; then
# Here we define the configuration differences for each location
case $srem_WL in
location1)
srem_ex+=" -r printer:MyPrinterForLocation1"
;;
location2)
srem_ex+=" -r printer:MyPrinterForLocation2"
;;
esac
# Since other has not been added to the case list it won't add anything
fi
# The end of our execute command
srem_ex+=" -u $srem_usr $srem_up"
# EXECUTE
$srem_ex
fi

0 comments:
Post a Comment