Results 1 to 6 of 6
Hi Everyone,
Im currently working on a project that involves a ssh connection to a remote machine that i often have to pkill x and reboot, trouble is every now ...
- 08-01-2011 #1Just Joined!
- Join Date
- Jul 2011
- Posts
- 5
Overwriting Poweful commands?
Hi Everyone,
Im currently working on a project that involves a ssh connection to a remote machine that i often have to pkill x and reboot, trouble is every now and then i do it on my dev machine, and its getting on my nerves
so i thought i could do something like this:
alias reboot= "echo 'you didnt mean to do that! if you did try reallyreboot"
alias reallyreboot = "shutdown -r now"
alias pkill = "echo 'you didnt mean to do that try reallypkill"
alias reallypkill=??
at first i thought i might get away with it if i defined the "really" alias before the overwrite, but that proved unsuccessful. is there anyway i can do the real pkill in a reallpkill alias but overwrite the pkill command? or at least add a "are you sure?"
maybe just an overwrite for the specific command "pkill -9 X"??
I would appreciate any help with this, if its not possible
I could just use an alternative command on the target, but we do have to keep changing the targets distro so doing it on the dev machine is a little bit more efficient
- 08-01-2011 #2
You can provide the full path to the program:
Code:alias reboot="echo 'Try reallyreboot'" alias reallyreboot="/sbin/shutdown -r now"
DISTRO=Arch
Registered Linux User #388732
- 08-01-2011 #3
Just out of curiosity:
Are you working on kernel modules, glibc or X modules?
I am just wondering, what kind of development would need constant reboots.Last edited by Irithori; 08-01-2011 at 06:40 PM. Reason: spelling
You must always face the curtain with a bow.
- 08-01-2011 #4Just Joined!
- Join Date
- Jul 2011
- Posts
- 5
Thanks Cabhan that will probably do it, any idea where pkill lives? i would of though sbin or bin but i cant find it, or is pkill an alias for kill???
@ Irithori its not really constant reboots, i actually find that i have to reboot most often when sshd throws a wobbly and i cant tunnel to the host from the target anymore, i think it has something to do with the connection timing out / the firewall blocking it. but my efforts so far haven't fixed this, ive tried extending the length of ServerAliveInterval on both the target and the host. Annoyingly just kill sshd and restarting it doesnt seem to do the trick and niether does killing the firewall on the target side, it might work if i kill the firewall on the host side but im not sure if i want to do that.
but only a reboot seems to fix the problem it causes. It is actually a kernel module that im working on but the reboots rarely have anything to do with the actual module.
- 08-01-2011 #5
You can always use the "which" command to find the full path of a command:
Code:alex@niamh:~$ which pkill /usr/bin/pkill
DISTRO=Arch
Registered Linux User #388732
- 08-02-2011 #6Just Joined!
- Join Date
- Jul 2011
- Posts
- 5
Thank you :)
Thank you that's really helpful! i Appreciate it very much!


2Likes
Reply With Quote