Checking if Backup is runnning ...

Hi,

Apple’s Backup app is not scriptable. How can I check if it is actually doing a Backup ? Not testing if the app is activated, but if the app is actually backuping to iDisk ?

I have a script that put my computer to sleep under certain condition and this is one of them.

Thanks in advance.

Robert Lespérance

Hi,

maybe you can check the CPU consumption of the process (with /bin/ps)

Hi Stefank,

How do you do that ? Not bad with AS but really beginner with shellscripting … Regards.

Robert

something like this


getProcessPercentCPU("Finder")

on getProcessPercentCPU(someProcess)
	do shell script "/bin/ps -xco %cpu,command  | /usr/bin/awk '/" & someProcess & "$/ {print $1}'"
end getProcessPercentCPU

Thank you …

Your script works with Backup. Why does it don’t work when applied to an application belonging to ROOT ?? Even when Retrospect is executing the script does not return the process percentage. Retrospect belongs to ROOT.

Regards.

Robert

A normal user (even with admin status) hasn’t sufficient access privileges to gather information which belongs to root.

Then if «Activity Monitor» can display Retrospect’s activity (even if it belongs to ROOT), is that information available to query with a shell script ?

Regards.

Robert

Hi StefanK,

This routine works:

on idle
	
	if getProcessPercentCPU("Backup") > 1 then
		say "Running"
	else
		say "Inactive"
	end if
	
	return 5
	
end idle


on getProcessPercentCPU(someProcess)
	do shell script "/bin/ps -xco %cpu,command  | /usr/bin/awk '/" & someProcess & "$/ {print $1}'"
end getProcessPercentCPU

When I copy and paste it in a more complex «on idle» routine, I get this Script Editor message:

Do you have a clue on this one ?

Robert

Good to hear, that the routine is working

You probably call a handler within an application tell block.
Either move the line with the call outside the tell block or use the keyword my before the handler’s name
to force AppleScript itself to perform the call

Thank you for your help. You are more precious than a gem.

In case you did not see this post … If «Activity Monitor» can display Retrospect’s activity (even if it belongs to ROOT), is that information available to query with a shell script ?

Regards.

Robert