Search the Community
Showing results for tags 'sh' in content posted in Programming / Scripts.
Found 2 results
Hello, I want to release my bash file that generates a all_logs.txt file that contains all syserrs messages from: All channels and all cores of each of them. Including game99 Including auth. Including db. all_logs.txt will look like this: There are currently no errors in my server so that is why it is very small and clean, but everything from all syserrs will be there for you waiting to solve it. I think it is much better instead of going one by one folder to check. In order to install follow the instructions below. Create a new file named show_all_syserr.sh in the same directory as your start.sh and/or other bash files. Open it and write the following code: #!/bin/sh rm -f all_logs.txt #Removes old all_logs.txt if already exists. starting_directory=$PWD #Saves current directory for further use. for current_directory in */*/ ; do ( #For every directory (2 hops, with that i mean 1 hop is going to channel1, channel2, channel3 etc... and second hop is going into core1, core2, core3 etc... (it does not matter how many channels you have or how many cores you have.)) it will collect syserr file contents and append it to all_logs.txt. cd "$current_directory" if [ -f syserr ]; then echo "*************************" >> $starting_directory/all_logs.txt echo "* Logs of $current_directory" >> $starting_directory/all_logs.txt echo "*************************" >> $starting_directory/all_logs.txt cat syserr >> $starting_directory/all_logs.txt fi ); done clear #Cleaning console after job has been done. if [ -f all_logs.txt ]; then #Checks if there is or not a all_logs.txt created. echo -e "\033[32mall_logs.txt created successfully in $starting_directory!\033[0m" else echo -e "\033[32mServer is error free, none syserr found!\033[0m" fi Save, go to console --> sh show_all_syserr.sh --> Wait for it to finish --> You are ready to examine the errors.
megatixos posted a topic in Programming / ScriptsHello, Whenever i logged in on my test-server i wanted to be more like X-Men movies (Welcome Professor!!! famous quote), so i wanted to create a human friendly environment, of course you can modify this to your needs, but this is my script that i want to share with you. Final result will be this: What does it do: Only after you successfully login in FreeBSD it will: Clear console so it will be clean and shiny! Print a welcome message. Print weather automatically parsed from your location (you need to set your location, i will show you how, it is very easy). Change directory (cd) to your desirable location (in my case i wanted to change directory in my start.sh location so i don't have to make the same command every time i login.). Of course you can do whatever else you want it to do. How to make this happen: Login press the following command ee ~/.login Notice that this command is not guaranteed to work on every FreeBSD version but should work on most cases Append the following commands: cd /usr/home/game #Where the change directory should go clear #Clear console after login echo "Welcome $USER!" #Welcome message ($USER variable is the current user logged in) curl -s http://wttr.in/thessaloniki | head -7 | tail -5 #This is the weather info, change "thessaloniki" with the city of your choice. Now press ctrl + C and "exit" (Without quotes, this will save the above information and exit to command line.). Now reboot or logout and login again and see the difference, much cleaner, isn't it?