ViTALiTY Posted August 7, 2014 Share Posted August 7, 2014 So, I need to have a script (I was recommended to use "at") that has to do the following commands: Command 1, Command 2, Command 3, Command 4, and Command 5. Command 1 is executed for 12 minutes. Then, it stops. Right after, Command 2, 3, 4 and 5 are executed for 10 minutes. Then, they stop. Command 1 is executed again for 12 minutes. Then, stop it. Commands 2, 3, 4 and 5 are executed again for 10 minutes, WITH a minor switch in one of the switches. Then, they stop. Repeat everything above. If you think you can do this, hit me a PM. It's related to reaver and mdk3, so it's not that hard, I just don't know how to do it. I am willing to offer two (or more) of these Steam games: Call of Duty: Black Ops GRID 2 THIEF Payday 2 The Elder Scrolls V: Skyrim Legendary Edition Far Cry 3 Assassin's Creed IV Black Flag Goat Simulator Dishonored GOTY Thanks in advance! Quote Link to comment Share on other sites More sharing options...
cooper Posted August 7, 2014 Share Posted August 7, 2014 Let's not even bother with at. And you can keep your games, I don't play any. :) #!/bin/bash Command 1 & sleep 720 # 720 seconds = 12 minutes killall Command 1 Command 2 & Command 3 & Command 4 & sleep 600 # 600 seconds = 10 minutes killall Command 2 killall Command 3 killall Command 4 while true do Command 1 & sleep 720 # 720 seconds = 12 minutes killall Command 1 Command 2 variant & Command 3 variant & Command 4 variant & sleep 600 # 600 seconds = 10 minutes killall Command 2 variant killall Command 3 variant killall Command 4 variant done Quote Link to comment Share on other sites More sharing options...
ViTALiTY Posted August 7, 2014 Author Share Posted August 7, 2014 (edited) THANKS! Deeply appreciated mate!Now, I didn't really want to bother you anymore with this, but it seems I am doing something wrong. Basically, here's the thing. I want to crack a friend's WPS router. But it locks me out every 10 tries. So I have to MDK3 the router until it reboots. After the router reboots, it changes the channel. It alternates between channel 6 and channel 1. I changed the script to my needs: http://pastebin.com/3uHWm0QT Then I SSH'd into the pineapple, SCPd the file to it and: http://pastebin.com/LwVtfMDr And that happens... Edited August 7, 2014 by ViTALiTY Quote Link to comment Share on other sites More sharing options...
cooper Posted August 7, 2014 Share Posted August 7, 2014 (edited) Replace /bin/bash on the first line with /bin/sh and make sure you don't have Windows line breaks at the end (though I think scp handles that for you). Edited August 7, 2014 by Cooper Quote Link to comment Share on other sites More sharing options...
Sitwon Posted August 7, 2014 Share Posted August 7, 2014 This is a better way. Killall can be a very blunt instrument. If you can know the PIDs, you should just kill them directly. #!/bin/bash Command 1 & C1=$! sleep 720 # 720 seconds = 12 minutes kill -9 $C1 Command 2 & C2=$! Command 3 & C3=$! Command 4 & C4=$! sleep 600 # 600 seconds = 10 minutes kill -9 $C2 $C3 $C4 while true do Command 1 & C1=$! sleep 720 # 720 seconds = 12 minutes kill -9 $C1 Command 2 variant & C2=$! Command 3 variant & C3=$! Command 4 variant & C4=$! sleep 600 # 600 seconds = 10 minutes kill -9 $C2 $C3 $C4 done If you want to get fancy, write a function to abstract it. #!/bin/bash function timedRun(){ TIME=$1 shift $@ & PID=$! ( sleep $TIME ; kill -9 $PID ) & } TIME1=720 TIME2=600 while true do timedRun $TIME1 Command 1 sleep $TIME1 timedRun $TIME2 Command 2 timedRun $TIME2 Command 3 timedRun $TIME2 Command 4 sleep $TIME2 done Quote Link to comment Share on other sites More sharing options...
cooper Posted August 7, 2014 Share Posted August 7, 2014 Nice. I didn't know about $! Quote Link to comment Share on other sites More sharing options...
ViTALiTY Posted August 8, 2014 Author Share Posted August 8, 2014 Thank you very much! You guys are damn awesome. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.