Skip to main content
Rollback to Revision 3
Source Link
Graham Miln
  • 45.6k
  • 8
  • 94
  • 128

Graphical User Session Required

The error occurs because the commands in your osascript require a graphical user session. AppleScript requires a graphical user session to work.

The launchd job is running as the root user in a non-graphical user session.

Alternative Approach

In these situations, the typical approach is to split daemons in two parts – one computer wide and another within each graphical user session. A pipe or socket is frequently used to communicate.

Even as root user, there are barriers that can not be crossed in macOS.


###Update:

I just wanted to add an addendum to this answer so others could see what I ended up doing.

I ended up removing the calls to the osascript and simply writing writing the date, time, and "Success/Failure" depending on if the action worked to a file called .toast in my home directory (~/.toast). I then have another scripts that reads that file once every morning for the "Errors" and if there are any, it writes them to a text file on my desktop and pops up a notification."

With this method, I can expand it to other bash scripts that are kicked off via launchd and have a single place to view my errors and be notified of them.

One thing to keep in mind is to make use of sudo even though the script is running as root. For instance, when writing to the .toast file, I issue the command:

sudo -u allan echo "$now SUCCESS: [${title}] -- Podcast Transferred successfully" >> /Users/allan/.toast 

Graphical User Session Required

The error occurs because the commands in your osascript require a graphical user session. AppleScript requires a graphical user session to work.

The launchd job is running as the root user in a non-graphical user session.

Alternative Approach

In these situations, the typical approach is to split daemons in two parts – one computer wide and another within each graphical user session. A pipe or socket is frequently used to communicate.

Even as root user, there are barriers that can not be crossed in macOS.


###Update:

I just wanted to add an addendum to this answer so others could see what I ended up doing.

I ended up removing the calls to the osascript and simply writing writing the date, time, and "Success/Failure" depending on if the action worked to a file called .toast in my home directory (~/.toast). I then have another scripts that reads that file once every morning for the "Errors" and if there are any, it writes them to a text file on my desktop and pops up a notification."

With this method, I can expand it to other bash scripts that are kicked off via launchd and have a single place to view my errors and be notified of them.

One thing to keep in mind is to make use of sudo even though the script is running as root. For instance, when writing to the .toast file, I issue the command:

sudo -u allan echo "$now SUCCESS: [${title}] -- Podcast Transferred successfully" >> /Users/allan/.toast 

Graphical User Session Required

The error occurs because the commands in your osascript require a graphical user session. AppleScript requires a graphical user session to work.

The launchd job is running as the root user in a non-graphical user session.

Alternative Approach

In these situations, the typical approach is to split daemons in two parts – one computer wide and another within each graphical user session. A pipe or socket is frequently used to communicate.

Even as root user, there are barriers that can not be crossed in macOS.

Rollback to Revision 4
Source Link
Graham Miln
  • 45.6k
  • 8
  • 94
  • 128

Graphical User Session Required

The error occurs because the commands in your osascript require a graphical user session. AppleScript requires a graphical user session to work.

The launchd job is running as the root user in a non-graphical user session.

Alternative Approach

In these situations, the typical approach is to split daemons in two parts – one computer wide and another within each graphical user session. A pipe or socket is frequently used to communicate.

Even as root user, there are barriers that can not be crossed in macOS.


###Update:

I just wanted to add an addendum to this answer so others could see what I ended up doing.

I ended up removing the calls to the osascript and simply writing writing the date, time, and "Success/Failure" depending on if the action worked to a file called .toast in my home directory (~/.toast). I then have another scripts that reads that file once every morning for the "Errors" and if there are any, it writes them to a text file on my desktop and pops up a notification."

With this method, I can expand it to other bash scripts that are kicked off via launchd and have a single place to view my errors and be notified of them.

One thing to keep in mind is to make use of sudo even though the script is running as root. For instance, when writing to the .toast file, I issue the command:

sudo -u allan echo "$now SUCCESS: [${title}] -- Podcast Transferred successfully" >> /Users/allan/.toast 

Graphical User Session Required

The error occurs because the commands in your osascript require a graphical user session. AppleScript requires a graphical user session to work.

The launchd job is running as the root user in a non-graphical user session.

Alternative Approach

In these situations, the typical approach is to split daemons in two parts – one computer wide and another within each graphical user session. A pipe or socket is frequently used to communicate.

Even as root user, there are barriers that can not be crossed in macOS.

Graphical User Session Required

The error occurs because the commands in your osascript require a graphical user session. AppleScript requires a graphical user session to work.

The launchd job is running as the root user in a non-graphical user session.

Alternative Approach

In these situations, the typical approach is to split daemons in two parts – one computer wide and another within each graphical user session. A pipe or socket is frequently used to communicate.

Even as root user, there are barriers that can not be crossed in macOS.


###Update:

I just wanted to add an addendum to this answer so others could see what I ended up doing.

I ended up removing the calls to the osascript and simply writing writing the date, time, and "Success/Failure" depending on if the action worked to a file called .toast in my home directory (~/.toast). I then have another scripts that reads that file once every morning for the "Errors" and if there are any, it writes them to a text file on my desktop and pops up a notification."

With this method, I can expand it to other bash scripts that are kicked off via launchd and have a single place to view my errors and be notified of them.

One thing to keep in mind is to make use of sudo even though the script is running as root. For instance, when writing to the .toast file, I issue the command:

sudo -u allan echo "$now SUCCESS: [${title}] -- Podcast Transferred successfully" >> /Users/allan/.toast 
Remove attempt to comment.
Source Link
Graham Miln
  • 45.6k
  • 8
  • 94
  • 128

Graphical User Session Required

The error occurs because the commands in your osascript require a graphical user session. AppleScript requires a graphical user session to work.

The launchd job is running as the root user in a non-graphical user session.

Alternative Approach

In these situations, the typical approach is to split daemons in two parts – one computer wide and another within each graphical user session. A pipe or socket is frequently used to communicate.

Even as root user, there are barriers that can not be crossed in macOS.


###Update:

I just wanted to add an addendum to this answer so others could see what I ended up doing.

I ended up removing the calls to the osascript and simply writing writing the date, time, and "Success/Failure" depending on if the action worked to a file called .toast in my home directory (~/.toast). I then have another scripts that reads that file once every morning for the "Errors" and if there are any, it writes them to a text file on my desktop and pops up a notification."

With this method, I can expand it to other bash scripts that are kicked off via launchd and have a single place to view my errors and be notified of them.

One thing to keep in mind is to make use of sudo even though the script is running as root. For instance, when writing to the .toast file, I issue the command:

sudo -u allan echo "$now SUCCESS: [${title}] -- Podcast Transferred successfully" >> /Users/allan/.toast 

Graphical User Session Required

The error occurs because the commands in your osascript require a graphical user session. AppleScript requires a graphical user session to work.

The launchd job is running as the root user in a non-graphical user session.

Alternative Approach

In these situations, the typical approach is to split daemons in two parts – one computer wide and another within each graphical user session. A pipe or socket is frequently used to communicate.

Even as root user, there are barriers that can not be crossed in macOS.


###Update:

I just wanted to add an addendum to this answer so others could see what I ended up doing.

I ended up removing the calls to the osascript and simply writing writing the date, time, and "Success/Failure" depending on if the action worked to a file called .toast in my home directory (~/.toast). I then have another scripts that reads that file once every morning for the "Errors" and if there are any, it writes them to a text file on my desktop and pops up a notification."

With this method, I can expand it to other bash scripts that are kicked off via launchd and have a single place to view my errors and be notified of them.

One thing to keep in mind is to make use of sudo even though the script is running as root. For instance, when writing to the .toast file, I issue the command:

sudo -u allan echo "$now SUCCESS: [${title}] -- Podcast Transferred successfully" >> /Users/allan/.toast 

Graphical User Session Required

The error occurs because the commands in your osascript require a graphical user session. AppleScript requires a graphical user session to work.

The launchd job is running as the root user in a non-graphical user session.

Alternative Approach

In these situations, the typical approach is to split daemons in two parts – one computer wide and another within each graphical user session. A pipe or socket is frequently used to communicate.

Even as root user, there are barriers that can not be crossed in macOS.

added 957 characters in body
Source Link
Allan
  • 105.7k
  • 33
  • 216
  • 490
Loading
Added alternative approach and formatting.
Source Link
Graham Miln
  • 45.6k
  • 8
  • 94
  • 128
Loading
added 121 characters in body
Source Link
Graham Miln
  • 45.6k
  • 8
  • 94
  • 128
Loading
Source Link
Graham Miln
  • 45.6k
  • 8
  • 94
  • 128
Loading