[clug] Centos 5 gnome .desktop app df -k

Neil Pickford neilp at goldweb.com.au
Wed Jul 31 11:25:26 UTC 2019


I am just starting to get familiar with gnome on Centos 5.1 (Yes I know 
its old but this is what the machine in question is running)
I am more of a command line admin. In this case it is a gnome desktop 
for operators.

What I am trying to do is create gnome App Link Icons for the operators 
to assist them in the workflow they are performing with the Centos 
machine that is importing large media archives from magnetic tape (LTO).
Primarily the App Link is for allowing operators to see that the 
destination volume is empty, full or half full.

The particular app function I am trying to replicate is a non 
interactive Disk Free - or simply df -k to std output in a gnome window 
that can then be closed by the operator or automatically closes after 10 
seconds.

I have placed a file FreeDisk.desktop in the operational users ~/Desktop 
directory which contains:

           [Desktop Entry]
           Version=1.0
           Encoding=UTF-8
           Type=Application
           Terminal=true
           Exec='df -k'
           Name=Free Disk
           Comment=Show Free Disk Space on mounted file-systems

A new App Link Icon named 'Free Disk' appears in the gnome desktop when 
I save the file - as expected.
However when I activate the new desktop App Link lcon I get a quick 
flash of a black terminal command window and then it disappears.
I tested df -k as the operator user in a gnome-terminal and it works as 
expected.

I changed the Exec= line to a number of variants below: - all did not work.
df
df -k
df -k ; sleep 10
/bin/bash 'df -k'
'df -k' ; sleep 10
/bin/bash -c 'df -k'
'/bin/bash -c df -k'

I even tried writing a bash script "FreeDisk.sh"  in the home directory:
chmod +x FreeDisk.sh
and executing that:

./FreeDisk.sh
works as expected

Exec=/bin/bash -c '~/FreeDisk.sh'
results in the previously experienced terminal flash.

I have also changed Terminal=True to False
- no change.

I also tried using:
Exec=gnome-open '~/FreeDisk.txt'
where FreeDisk.txt contains the std output of df -k

I suppose I could use Exec=gnome-terminal however I was really not 
wanting to present an interactive terminal session rather an automated 
macro that displays the data from df.

Looking at other previously placed operator desktop app icons such as a 
log monitor the Exec line contains:
Exec=tail -f /mountpoint/log/logfile

This seems to work as expected and is functionally similar to the 
FreeDisk app link.
The .desktop file has the same permissions and I even tried copying the 
log monitor .desktop file and modifying the appropriate parameters.

What I am trying to do is pretty basic and simple - I can expand it 
later when I make the basics work.

I am obviously missing some vital piece of the puzzle here, can anyone 
help me out?

An yes I have googled this subject extensively and read many man pages, 
btw there appears not to be a man page for gnome-open.

NeilP





More information about the linux mailing list