This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This gonna be usefull when U have some pattern actvities to done continously wo/ doing it manually | |
1. Problem: need to execute `arp -d` continously, the command to delete host on arp table to reset it to first time connect to wifi or other connection gateway. This could even be prevent the user in same connection's gateway which use `internet cut` software (might be myth). Every time the command execute, your computer delete the inet_addr that already chaced to your computer then re-request to gateway point to give you new chace. This usually used when your computer have problem to connect to internet, so your computer need to refresh the chace inet_addr. (I might be wrong sorry, I'm not expert) | |
#!/bin/bash | |
echo 'Running command' | |
set -x #echo on everything the command executed | |
while true; | |
do | |
arp -d | |
sleep 0.5 | |
done | |
#saved with <filename>.sh & execute it with your own way | |
2. start stop get status mongodb in linux 16.04, but make sure you already install mongodb | |
================ | |
start_mongodb.sh | |
================ | |
#!/bin/bash | |
echo 'starting mongo db service' | |
sudo systemctl start mongodb.service | |
echo 'done!' | |
=============== | |
stop_mongodb.sh | |
=============== | |
#!/bin/bash | |
echo 'stoping mongo db service' | |
sudo systemctl stop mongodb.service | |
echo 'done!' | |
================= | |
status_mongodb.sh | |
================= | |
#!/bin/bash | |
mongo --eval "db.stats()" # do a simple harmless command of some sort | |
RESULT=$? # returns 0 if mongo eval succeeds | |
if [ $RESULT -ne 0 ]; then | |
echo "mongodb not running" | |
exit 1 | |
else | |
echo "mongodb running!" | |
fi | |
======================================== | |
FOR WINDOWS user can use this one | |
======================================== | |
*Note: make sure you already make your MongoDb as a service, to make it as easily install MongoDB compass software, | |
it would automatically make it as service or you see here: | |
- https://medium.com/stackfame/run-mongodb-as-a-service-in-windows-b0acd3a4b712 | |
- https://stackoverflow.com/a/41073438 | |
================ | |
start_mongodb.sh | |
================ | |
#!/bin/bash | |
echo 'Trying to START service MongoDB' | |
set -x #for echo on | |
net start MongoDB | |
echo 'Done START service MongoDB' | |
sleep 3 #3 secs | |
=============== | |
stop_mongodb.sh | |
=============== | |
#!/bin/bash | |
echo 'Trying to STOP service MongoDB' | |
set -x #for echo on | |
net stop MongoDB | |
echo 'Done STOP service MongoDB' | |
sleep 3 #3 secs | |
================= | |
status_mongodb.sh | |
================= | |
for this one you can use script above | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment