Δεν χρειαζεται απαραιτητα script, μπορεις να το κανεις και με την εντολη find, δες αυτο...
http://content.hccfl.edu/pollock/Unix/FindCmd.htm
και φυσικα τα man pages.
Συντονιστής: konnn
#!/bin/bash
echo Προσπαθώ
cd /media/home_per/χχχχχ/programming/python/programma
echo 'Προσπαθώ'
PATH=$PATH:/media/home_per/χχχχχ/programming/python/programma
da_perama1 έγραψε:Πάντως μου έμεινε η απορία γιατί δεν δουλεύει το script.
έγραψε:1.3.1. General
Bash determines the type of program that is to be executed. Normal programs are system commands that exist in compiled form on your system. When such a program is executed, a new process is created because Bash makes an exact copy of itself. This child process has the same environment as its parent, only the process ID number is different. This procedure is called forking.
...
...
...
1.3.3. Executing programs from a script
When the program being executed is a shell script, bash will create a new bash process using a fork. This subshell reads the lines from the shell script one line at a time. Commands on each line are read, interpreted and executed as if they would have come directly from the keyboard.
While the subshell processes each line of the script, the parent shell waits for its child process to finish. When there are no more lines in the shell script to read, the subshell terminates. The parent shell awakes and displays a new prompt.
K Debian Testing 64bit|Ιntel i5 3rd|8GBRam|IntelHD4000 D Ευρετήριο οδηγών και how-to | Τερματικό για..αρχάριους E Ρώτα με τον έξυπνο τρόπο | Οδηγίες για νέους | |
find -type f -regextype posix-egrep -regex "^.*[^1]1.rar$" -execdir unrar e -kb {} \;
find -type f -cmin -2 -not -iname "*.rar" -execdir mv {} ~/Desktop/MyKatalogos/ \;
find -type f -regextype posix-egrep -regex "^.*1$" -execdir unrar e -kb {} \;
find -type f -cmin -2 -not -iname "*.rar*" -execdir mv {} ~/Desktop/MyKatalogos/ \;
chmod +x cpuMon.sh
watch -n.6 ./cpuMon.sh
watch -n 1 ./cpuMon.sh
#!/bin/bash
#
# cpuMon.sh
# Monitors CPU load and logs it if it exceeds the threshold
# Usage : watch ./cpuMon.sh
# also with parameter -n in watch
# Example: watch -n.6 ./cpuMon.sh
# every 600 miliseconds
threshold="90.0"
dFile="/home/$USER/cpuPeak.txt"
# Get current total-CPU-load (by adding all processes's %CPU)
cpuLoad=`ps aux --no-headers --sort=-%cpu | awk '{cpuload += $3} END {print cpuload}'`
#Change : Added support for Comparison of Floating point numbers ( because 9.1 is smaller than 80.0 ) but bash does not "see" that :-)
#If cpuLoad is greater than the threshold , ReturnStatus will be 1
echo $cpuLoad |awk '{ if ( $1 > '$threshold') {exit 1}};'
ReturnStatus=$?
#if awk returns 1 means that cpuLoad has become greater than our thresold so we can log
# If the sum is greater than the threshold, log top-10 processes
if [ "$ReturnStatus" -eq 1 ]; then
echo =====[ CPU load = "$cpuLoad" ]===== >> "$dFile"
date >> "$dFile"
ps aux --no-headers --sort=-%cpu | head -n10 >> "$dFile"
echo >> "$dFile"
fi
exit