Need Linux command to reset / restart printer

knowyrtech

New Member
Credits
64
I have a shell script code that prints any new PDF generated to a Brother printer which is connected to a MACOS using the below command

lp -d Brother_HL_L2350DW_series /var/pdfs/11.pdf

After 2 or 3 days the printer stops to print and I see the printer queue growing with the error message The printer is not responding. See below snapshot:

1620077997703.png


tail /var/log/cups/error_log

E [26/Apr/2021:13:38:45 +0200] [Job 15850] The printer is not responding.
E [26/Apr/2021:13:39:45 +0200] [Job 15850] The printer is not responding.

Rustems-iMac:~ rustemince$ lpstat -a
Brother_HL_L2350DW_series accepting requests since Mo 26 Apr 13:24:09 2021
Brother_HL_L2350DW_series_2 accepting requests since Fr 9 Apr 15:28:24 2021
Canon_TS700_series accepting requests since Mo 26 Apr 15:00:32 2021
HP_LaserJet_M203_M206 accepting requests since Sa 3 Apr 09:24:54 2021
HP_LaserJet_M203dw__5F40D6_ accepting requests since Mo 29 Mär 12:26:13 2021
Kyocera_ECOSYS_M5526cdw accepting requests since Di 6 Apr 18:27:08 2021
Kyocera_ECOSYS_M5526cdw_b_3_Fax accepting requests since Di 7 Jan 21:51:33 2020

sudo journalctl -b 0 -u cups
-bash: journalctl: command not found

If I manually power off and power on the printer it works and starts the pending prints.

Thus my requirement is to have linux MacOS commands for the below tasks:

  1. Reset / Restart the printer using command-line
  2. Reprint the Printer Queue
Kindly help.
 


KGIII

Super Moderator
Staff member
Gold Supporter
Credits
28,617
linux MacOS
I am awfully confused.

-bash: journalctl: command not found
Alright... I *may* be less confused.

Do you have an Apple computer running Mac OS?

POSIX compliant doesn't mean Linux. Mac is based on a Unix, and Unix is not Linux. Nor is Linux Unix, for that matter. Linux strives to be POSIX compliant, but I suspect that's not important right now.

Having an Apple computer running OSX (or any other previous Mac OS) would result in journalctl not being found. The journalctl command is a systemd command and would only be useful with a Linux computer that uses systemd.

So, what do you actually have running and how can we (a bunch of Linux users) help you?

By the way, I'm familiar with the "AskDifferent" section of StackExchange. If you're actually using a Mac, then that's a good place for you to ask questions. I'll get you a link:


Remember, they use a very specific format there. You'll want to be sure to check the guidelines and follow them. They'll close any improper questions. It's very much a Question and Answer format, and not for conversations. It's not a forum, it's a Q&A site and strictly such.
 

knowyrtech

New Member
Credits
64
I am awfully confused.



Alright... I *may* be less confused.

Do you have an Apple computer running Mac OS?

POSIX compliant doesn't mean Linux. Mac is based on a Unix, and Unix is not Linux. Nor is Linux Unix, for that matter. Linux strives to be POSIX compliant, but I suspect that's not important right now.

Having an Apple computer running OSX (or any other previous Mac OS) would result in journalctl not being found. The journalctl command is a systemd command and would only be useful with a Linux computer that uses systemd.

So, what do you actually have running and how can we (a bunch of Linux users) help you?

By the way, I'm familiar with the "AskDifferent" section of StackExchange. If you're actually using a Mac, then that's a good place for you to ask questions. I'll get you a link:


Remember, they use a very specific format there. You'll want to be sure to check the guidelines and follow them. They'll close any improper questions. It's very much a Question and Answer format, and not for conversations. It's not a forum, it's a Q&A site and strictly such.
Sorry for the confusion but the reason I mentioned Linux MacOS as one is because the below printer command runs same on both Linux as well as on MacOS.

lp -d Brother_HL_L2350DW_series /var/pdfs/11.pdf

Thus, I'm having MacOS where I need printer commands for the below:

  1. Reset / Restart the printer using command-line
  2. Reprint the Printer Queue
 

KGIII

Super Moderator
Staff member
Gold Supporter
Credits
28,617
Again, this is a Linux site. We don't know the commands for Apple's OSX or any other Mac OS. You'll need the Apple equivalents. Just because there are some similarities doesn't mean you want Linux commands.

As it is a Unix, you may get better results following backwards from your question here:


From that link:

That's irrelevant. Not getting an answer there does not make an off-topic question become suddenly askable here. This site is strictly for programming related questions. If you're not getting answers at the other site, edit your post to get it back on the front page and see if you get an answer. – Ken White 1 hour ago
https://stackoverflow.com/questions/67375588/need-linux-command-to-reset-restart-printer#comment119090201_67375588
 

knowyrtech

New Member
Credits
64
Can you help me linux commands for
  1. Reset / Restart the printer using command-line
  2. Reprint the Printer Queue
Once I have them I will find the MacOS equivalent myself.
 

dos2unix

Well-Known Member
Credits
4,612
 

Alexzee

Well-Known Member
Credits
9,213
When my printer used to do that I would go to the cups website, stop all jobs, delete the printer and than add it again.
That was the only practice that made what you have going one stop for me.

My printer is an HP though not a Brother.
 

Alexzee

Well-Known Member
Credits
9,213
@Alexzee Can you share the commands you used to do this?
I didn't use any commands.

What I did was go to the CUPS website: http://localhost:631
Once there I cancelled all jobs and than deleted the printer.
Than re-installed the printer.

What Linux distro are you running?

OR are you not running Linux on your Mac?
 
Last edited:

Nik-Ken-Bah

Well-Known Member
Credits
2,289
I didn't use any commands.
I Have a HP printer /scanner a deskjet 1050 and use Hplip-gui and Hplip Both of which are in the software manger for mint,to sort out any problems it also allows me to maintain my printer such as cleaning the cartridges etc. In Vindows it is known as Dr Hp from memory(which is a bit thick at the moment).
But having said that I will have to remember the CUPS site which is now bookmarked. Ta for the the info.
 

knowyrtech

New Member
Credits
64
@KGIII & @Alexzee Below is the error when the printer stops printing.

Rustems-iMac:~ rustemince$ lpstat -l

Brother_HL_L2350DW_series-16617 rustemince 12288 So 9 Mai 20:17:51 2021
Status: Can't open "/private/var/spool/cups/d16617-001."
Alerts: job-completed-with-errors
queued for Brother_HL_L2350DW_series

Using `cancel` or `lprm` i can clear the print queue but how do I reset the printer and retry this print?

Below are more details at the time of the issue:

Rustems-iMac:~ rustemince$ lpstat -r
scheduler is running

Rustems-iMac:~ rustemince$ lpstat -p
printer Brother_HL_L2350DW_series disabled since Di 11 Mai 13:55:13 2021 -
reason unknown
printer Brother_HL_L2350DW_series_2 is idle. enabled since Fr 9 Apr 15:28:24 2021

I m using the latest MacOS and not linux.
 
Last edited:

Alexzee

Well-Known Member
Credits
9,213
I don't have a Mac so I had to look up how to reset the printer.
See the Google search below for more help.

On your Mac, choose Apple menu > System Preferences, then click Printers & Scanners. Press and hold the Control key as you click in the list at the left, then choose “Reset printing system” from the menu that appears.


HTH
 

knowyrtech

New Member
Credits
64
@Alexzee Thank you for the input however, I need the same reset instructions as the command line as I wish to incorporate this in my script.
 
Last edited:

Lord Boltar

Well-Known Member
Credits
6,011
@Lord Boltar I need command line instructions and not using browser
With macOS Catalina, Apple silently introduced a new option in their printtool command line tool to reset the printing system. Type the following in Terminal:
Code:
/System/Library/Frameworks/ApplicationServices.framework/Frameworks/PrintCore.framework/Versions/A/printtool --reset -f
also have a look here
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!


Top