LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   ChromeOS (https://www.linuxquestions.org/questions/chromeos-130/)
-   -   Linux Program doesn't run automatically from a script at reboot in ChromeOs (https://www.linuxquestions.org/questions/chromeos-130/linux-program-doesnt-run-automatically-from-a-script-at-reboot-in-chromeos-4175735663/)

Bepp65T 04-04-2024 04:44 AM

Linux Program doesn't run automatically from a script at reboot in ChromeOs
 
Hello.
First, I am a beginner in Linux and my english is not good. :)

I have a ChromeOS system with Debian GNU/Linux 12 (bookworm).
I've installed some Linux App like GIMP, Thunderbird, Deja-dup (for Backup), Abiword.... They normally wok fine.

Now, I can try to run automatically at reboot (from Linux) Deja-DUp (to backup my disks).

I've edit crontab and insert a line that invoke a script at @reboot option.
I've put echo instruction with labels in Crontab and in the script and I've seen both in internal mail.

But the program Deja-dup doesn't start. I've made a lot of attempts without success. I think because is not yet active the Linux graphic. Instead, if I run the script from terminal, the program Deja-dup start and run correctly...

I put sleep instructions in the script and in crontab to delay execution, without success.
I've also seen that $Display was "" instead of :0 at reboot execution. I've forced this value, but it doesn't work .

Below first the script and after the email reporting after the boot:

----------SCRIPT---------------
#!/bin/sh
sleep 15s
echo "Hello Beppe Start Shell"
echo "PATH"
PATH=/usr/bin:/bin:/usr/libexec/deja-dup
echo $PATH
DISPLAY=:0
echo "DISPLAY"
echo $DISPLAY
/usr/bin/deja-dup &
#!
#!deja-dup --backup
#!/usr/libexec/deja-dup/deja-dup-monitor &
#! wait
#!disown
#!
echo "Hello Beppe End Shell"
-------------------------
---EMAIL REPORTING-------
-------------------------
Delivery-date: Thu, 04 Apr 2024 11:16:21 +0200
Received: from bepp652 by penguin with local (Exim 4.96)
(envelope-from <bepp652@penguin>)
id 1rsJCn-0000DY-15
for bepp652@penguin;
Thu, 04 Apr 2024 11:16:21 +0200
From: root@penguin (Cron Daemon)
To: bepp652@penguin
Subject: Cron <bepp652@penguin> sleep 6 && /home/bepp652/reboot_beppe.sh
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/home/bepp652>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=bepp652>
Message-Id: <E1rsJCn-0000DY-15@penguin>
Date: Thu, 04 Apr 2024 11:16:21 +0200

Hello Beppe Start Shell
PATH
/usr/bin:/bin:/usr/libexec/deja-dup
DISPLAY
:0
Hello Beppe End Shell
?

----------------

Sometimes I also have the error: (org.gnome.DejaDup:1129): Gtk-WARNING **: 12:52:27.166: cannot open display:

I've also try to create /etc/rc.local and run deja-dup from this file, but it doesnt' work.
Finally I've tried to create org.gnome.DejaDup.desktop in folder /home/bepp662/.config/autostart, but without success...

Both, rc.local and folder autostart, weren't present on my system and so I've created both, but probably my system doesn't work with these 2 options....

Ah... I've also tried to run Abiword at reboot... same results :(

Have you any ideas how to run deja-dup at reboot?

Thank you in advance.
Best regards.
Beppe

pan64 04-09-2024 06:08 AM

Quite good progress, almost there.
crontab has no right to start GUI apps, therefore it could not succeed.
You have gnome, so probably this will be helpful: https://help.gnome.org/users/gnome-h...-start.html.en

Bepp65T 04-12-2024 10:41 AM

1 Attachment(s)
Hi.
thanks a lot for your help.
I've installed gnome-tweaks (it wasn't on my system), but run with some errors:
<..
WARNING : Error getting shell mode
CRITICAL: Error getting shell version
WARNING : Could not list shell extensions
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/gtweak/tweaks/tweak_group_appearance.py", line 144, in __init__
extensions = self._shell.list_extensions()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/gtweak/gshellwrapper.py", line 76, in list_extensions
return self._proxy.proxy_extensions.ListExtensions()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/gi/overrides/Gio.py", line 349, in __call__
result = self.dbus_proxy.call_sync(self.method_name, arg_variant,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
gi.repository.GLib.GError: g-dbus-error-quark: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.Shell was not provided by any .service files (2) ()

..>>

and I've used Autostart function, but it doesn't work at reboot.. Probably for errors...

I've attached also the process list active in Linux if you want to see... (I've run deja-dup from Chrome_OS, but it is the same situation if I run deja-dup from my script in terminal)

I think that it is impossible to run deja-dup or any aother graphic linux app at reboot with Linux ChromeOS due to graphic is not present at the time....

Thank you.

murugesandins 04-16-2024 09:31 PM

I don't have Linux OS here.
Can you retest the same using:
Code:

#!/bin/sh
/usr/bin/sleep 15s
echo "Hello Beppe Start Shell"
echo "PATH"
export PATH=/usr/bin:/bin:/usr/libexec/deja-dup
echo $PATH
export DISPLAY=:0
echo "DISPLAY"
echo $DISPLAY
/usr/bin/deja-dup &
#!
#!deja-dup --backup
#!/usr/libexec/deja-dup/deja-dup-monitor &
#! wait
#!disown
#!
echo "Hello Beppe End Shell"


michaelk 04-16-2024 10:05 PM

deja-dup uses its deja-dup-monitor which should run automatically for scheduled backups so starting the GUI program is not necessary. If you look at the process list you posted it is running.


All times are GMT -5. The time now is 07:40 AM.